Part Number Hot Search : 
2SC16 BGY88 74F2645 MXD1816 74AC10 MAX150 5261B 5ETTTS
Product Description
Full Text Search
 

To Download ATTINY28L-4PU Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1 features ? utilizes the avr ? risc architecture ? avr ? high-performance and low-power risc architecture ? 90 powerful instructions ? most single clock cycle execution ? 32 x 8 general-purpose working registers ? up to 4 mips throughput at 4 mhz ? nonvolatile program memory ? 2k bytes of flash program memory ? endurance: 1,000 write/erase cycles ? programming lock for flash program data security ? peripheral features ? interrupt and wake-up on low-level input ? one 8-bit timer/counter with separate prescaler ? on-chip analog comparator ? programmable watchdog timer with on-chip oscillator ? built-in high-current led driver with programmable modulation ? special microcontroller features ? low-power idle and power-down modes ? external and internal interrupt sources ? power-on reset circuit with programmable start-up time ? internal calibrated rc oscillator ? power consumption at 1 mhz, 2v, 25 c ? active: 3.0 ma ? idle mode: 1.2 ma ? power-down mode: <1 a ? i/o and packages ? 11 programmable i/o lines, 8 input lines and a high-current led driver ? 28-lead pdip, 32-lead tqfp, and 32-pad mlf ? operating voltages ?v cc : 1.8v - 5.5v for the attiny28v ?v cc : 2.7v - 5.5v for the attiny28l ? speed grades ? 0 - 1.2 mhz for the attiny28v ? 0 - 4 mhz for the attiny28l pin configurations pdip reset pd0 pd1 pd2 pd3 pd4 vcc gnd xtal1 xtal2 pd5 pd6 pd7 (ain0) pb0 pa0 pa1 pa3 pa2 (ir) pb7 pb6 gnd nc vcc pb5 pb4 (int1) pb3 (int0) pb2 (t0) pb1 (ain1) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 28 27 26 25 24 23 22 21 20 19 18 17 16 15 tqfp/qfn/mlf 1 2 3 4 5 6 7 8 24 23 22 21 20 19 18 17 pd3 pd4 nc vcc gnd nc xtal1 xtal2 pb7 pb6 nc gnd nc nc vcc pb5 32 31 30 29 28 27 26 25 9 10 11 12 13 14 15 16 pd5 pd6 pd7 (ain0) pb0 (ain1) pb1 (t0) pb2 (int0) pb3 (int1) pb4 pd2 pd1 pd0 reset pa0 pa1 pa3 pa2 (ir) 8-bit microcontroller with 2k bytes of flash attiny28l attiny28v rev. 1062f?avr?07/06
2 attiny28l/v 1062f?avr?07/06 description the attiny28 is a low-power cmos 8-bit microcontroller based on the avr risc archi- tecture. by executing powerful instructions in a single clock cycle, the attiny28 achieves throughputs approaching 1 mips per mhz, allowing the system designer to optimize power consumption versus processing speed. the avr core combines a rich instruction set with 32 general-purpose working registers. all the 32 registers are directly con- nected to the arithmetic logic unit (alu), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. the resulting architec- ture is more code efficient while achieving throughputs up to ten times faster than conventional cisc microcontrollers. block diagram figure 1. the attiny28 block diagram the attiny28 provides the following features: 2k bytes of flash, 11 general-purpose i/o lines, 8 input lines, a high-current led driver, 32 general-purpose working registers, an 8-bit timer/counter, internal and external interrupts, programmable watchdog timer with internal oscillator and 2 software-select able power-saving modes. the idle mode stops the cpu while allowing the time r/counter and interrupt system to continue functioning. the power-down mode saves the register contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. the wake-up or inter- program counter internal oscillator watchdog timer stack pointer program flash mcu control register general purpose registers instruction register timer/ counter instruction decoder data register portb programming logic timing and control interrupt unit status register alu portb vcc gnd control lines + - analog comparator 8-bit data bus z oscillator portd data register porta porta porta control register xtal2 xtal1 reset hardware stack data register portd data dir reg. portd hardware modulator internal calibrated oscillator
3 attiny28l/v 1062f?avr?07/06 rupt on low-level input feature enables the attiny28 to be highly responsive to external events, still featuring the lowest power co nsumption while in th e power-down modes. the device is manufactured using atmel?s hi gh-density, nonvolatile memory technology. by combining an enhanced risc 8-bit cpu with flash on a monolithic chip, the atmel attiny28 is a powerful microcontroller that provides a highly flexible and cost-effective solution to many embedded control applications. the attiny28 avr is supported with a full suite of program and system developm ent tools including: macro assemblers, pro- gram debugger/simulators, in-circuit emulators and evaluation kits. pin descriptions vcc supply voltage pin. gnd ground pin. port a (pa3..pa0) port a is a 4-bit i/o port. pa2 is output-only and can be used as a high-current led driver. at v cc = 2.0v, the pa2 output buffer can sink 25 ma. pa3, pa1 and pa0 are bi-directional i/o pins with internal pull-ups (s elected for each bit). the port pins are tri- stated when a reset condition becomes active, even if the clock is not running. port b (pb7..pb0) port b is an 8-bit input port with internal pull-ups (selected for all port b pins). port b pins that are externally pulled low will sour ce current if the pu ll-ups are activated. port b also serves the functions of various special features of the attiny28 as listed on page 27. if any of the special features are enabled, the pull-up(s) on the corresponding pin(s) is automatically disabled. the por t pins are tri-stated when a reset condition becomes active, even if the clock is not running. port d (pd7..pd0) port d is an 8-bit i/o port. port pins can pr ovide internal pull-up resistors (selected for each bit). the port pins are tri-stated when a reset condition becomes active, even if the clock is not running. xtal1 input to the inverting oscillato r amplifier and input to the in ternal clock operating circuit. xtal2 output from the invert ing oscillator amplifier. reset reset input. an external reset is generated by a low level on the reset pin. reset pulses longer than 50 ns will generate a reset, even if the clock is not running. shorter pulses are not guaranteed to generate a reset. figure 2.
4 attiny28l/v 1062f?avr?07/06 architectural overview the fast-access register file concept contains 32 x 8-bit general-purpose working regis- ters with a single clock cycle access time. this means that during one single clock cycle, one alu (arithmetic logic unit) operation is executed. two operands are output from the register file, the operation is executed, and the result is stored back in the register file ? in one clock cycle. two of the 32 registers can be used as a 16-bit pointer for indirect memory access. this pointer is called the z-pointer and can address the register file and the flash program memory. figure 3. the attiny28 avr risc architecture the alu supports arithmetic and logic functions between registers or between a con- stant and a register. single register operations are also executed in the alu. figure 3 shows the attiny28 avr risc microcontroller architecture. the avr uses a harvard architecture concept ? with separate memories and buses for program and data memo- ries. the program memory is accessed with a two-stage pipeline. while one instruction is being executed, the next instruction is pre-fetched from the program memory. this concept enables instructions to be execut ed every clock cycle. the program memory is reprogrammable flash memory. with the relative jump and relative call instructions, the whole 1k address space is directly accessed. all avr instructions have a single 16-bit word format, meaning that every program memory address contains a single 16-bit instruction. during interrupts and subroutine calls, the return address program counter (pc) is stored on the stack. the stack is a 3-level-deep hardware stack dedicated for subrou- tines and interrupts. the i/o memory space contains 64 addresses for cpu peripheral functions such as control registers, timer/counters and other i/o functions. the memory spaces in the avr architecture are all linear and regular memory maps. a flexible interrupt module has its control registers in the i/o space with an additional global interrupt enable bit in the status register. all the different interrupts have a sepa- control lines alu data bus 8-bit 1k x 16 program flash instruction register instruction decoder program counter status and test 32 x 8 general purpose registrers z control registrers interrupts unit 8-bit timer/counter watchdog timer analog comparator 20 i/o lines
5 attiny28l/v 1062f?avr?07/06 rate interrupt vector in the interrupt vector table at the beginning of the program memory. the different interrupts have priority in accordance with their interrupt vector position. the lower the interrupt vector address, the higher the priority. alu ? arithmetic logic unit the high-performance avr alu operates in direct connection with all the 32 general- purpose working registers. within a single clock cycle, alu operations between regis- ters in the register file are executed. the alu operations are divided into three main categories ? arithmetic, logic and bit functions. some microcontrollers in the avr prod- uct family feature a hardware multiplier in the arithmetic part of the alu. subroutine and interrupt hardware stack the attiny28 uses a 3-level-deep hardware stack for subroutines and interrupts. the hardware stack is 10 bits wide and stores the program counter (pc) return address while subroutines and interrupts are executed. rcall instructions and interrupts push the pc return address onto stack level 0, and the data in the other stack levels 1 - 2 are pushed one level deeper in the stack. when a ret or reti instruction is executed the retu rning pc is fetched from stack level 0, and the data in the other stack levels 1 - 2 are popped one level in the stack. if more than three subsequent subroutine calls or interrupts are executed, the first val- ues written to the stack are overwritten. general-purpose register file figure 4 shows the structure of the 32 general-purpose registers in the cpu. figure 4. avr cpu general-purpose working registers all the register operating instructions in the instruction set have direct and single cycle access to all registers. the only exception are the five constant arithmetic and logic instructions sbci, subi, cpi, andi and ori between a constant and a register and the ldi instruction for load immediate constant data. these instructions apply to the second half of the registers in the register file ? r16..r31. the general sbc, sub, cp, and, or and all other operations between two registers or on a single register apply to the entire register file. registers 30 and 31 form a 16-bit pointer (the z-pointer), which is used for indirect flash memory and register file access. when the register file is accessed, the contents of r31 are discarded by the cpu. 70 r0 r1 r2 general ? purpose ? working r28 registers r29 r30 (z-register low byte) r31(z-register high byte)
6 attiny28l/v 1062f?avr?07/06 status register status register ? sreg the avr status register (sreg) at i/o space location $3f is defined as: ? bit 7 ? i: global interrupt enable the global interrupt enable bit must be set (one) for the interrupts to be enabled. the individual interrupt enable control is then performed in separate control registers. if the global interrupt enable register is cleared (z ero), none of the interrupts are enabled inde- pendent of the individual interrupt enable settings. the i-bit is cleared by hardware after an interrupt has occurred, and is set by the reti instruction to enable subsequent interrupts. ? bit 6 ? t: bit copy storage the bit copy instructions bld (bit load) and bst (bit store) use the t-bit as source and destination for the operated bit. a bit from a register in the register file can be copied into t by the bst instruction, and a bit in t can be copied into a bit in a register in the register file by the bld instruction. ? bit 5 ? h: half-carry flag the half-carry flag h indicates a half-carry in some arithmetic operations. see the instruction set description for detailed information. ? bit 4 ? s: sign bit, s = n v the s-bit is always an exclusive or between the negative flag n and the two?s comple- ment overflow flag v. see the instruction set description for detailed information. ? bit 3 ? v: two?s complement overflow flag the two?s complement overflow flag v supports two?s complement arithmetic. see the instruction set description for detailed information. ? bit 2 ? n: negative flag the negative flag n indicates a negative result from an arithmetical or logical operation. see the instruction set description for detailed information. ? bit 1 ? z: zero flag the zero flag z indicates a zero result from an arithmetical or logical operation. see the instruction set description for detailed information. ? bit 0 ? c: carry flag the carry flag c indicates a carry in an arithmetical or logical operation. see the instruc- tion set description for detailed information. note that the status register is not automatically stored when entering an interrupt rou- tine and restored when returning from an interrupt routine. this must be handled by software. bit 76543210 $3f i t h s v n z c sreg read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value 0 0 0 0 0 0 0 0
7 attiny28l/v 1062f?avr?07/06 system clock and clock options the device has the following clock source options, selectable by flash fuse bits as shown in table 1. note: ?1? means unprogrammed, ?0? means programmed. the various choices for each clocking option give different start-up times as shown in table 5 on page 16. internal rc oscillator the internal rc oscillator opt ion is an on-chip calibrated os cillator running at a nominal frequency of 1.2 mhz. if selected, the device can operate with no external components. the device is shipped with this option selected. calibrated internal rc oscillator the calibrated internal oscillator provides a fixed 1.2 mhz (nominal) clock at 3v and 25 c. this clock may be used as the system clock. this oscillator can be calibrated by writing the calibration byte to the osccal register. when this oscillator is used as the chip clock, the watchdog oscillator will still be used for the watchd og timer and for the reset time-out. for details on how to use the pre-programmed calibration value, see the section ?calibration byte? on page 46. crystal oscillator xtal1 and xtal2 are input and output, respectively, of an inverting amplifier, which can be configured for use as an on-chip osc illator, as shown in fi gure 5. eit her a quartz crystal or a ceramic resonator may be used. when the intcap fuse is programmed, internal load capacitors with typical values 50 pf are connected between xtal1/xtal2 and ground. figure 5. oscillator connections note: 1. when using the mcu oscillator as a clock for an external device, an hc buffer should be connected as indicated in the figure. external clock to drive the device from an external clock source, xtal2 should be left unconnected while xtal1 is driven as shown in figure 6. table 1. device clocking option select clock option cksel3..0 external crystal/ceramic resonator 1111 - 1010 external low-frequency crystal 1001 - 1000 external rc oscillator 0111 - 0101 internal rc oscillator 0100 - 0010 external clock 0001 - 0000 xtal2 xtal1 gnd c2 c1 max 1 hc buffer hc
8 attiny28l/v 1062f?avr?07/06 figure 6. external clock dr ive configuration external rc oscillator for timing insensitive applicat ions, the external rc configuration shown in figure 7 can be used. for details on how to choose r and c, see table 25 on page 56. figure 7. external rc configuration xtal2 xtal1 gnd nc external oscillator signal xtal2 xtal1 gnd nc c r v cc
9 attiny28l/v 1062f?avr?07/06 register description oscillator calibration register ? osccal ? bits 7..0 ? cal7..cal0: oscillator calibration value writing the calibration byte to this address will trim the inte rnal oscillator to remove pro- cess variation from the oscillator frequency. when osccal is zero, the lowest available frequency is chosen. writing no n-zero values to the register will increase the frequency to the internal oscillator. writing $ff to the register gives the highest available fre- quency. table 2 shows the range for osccal. note that the oscillator is intended for calibration to 1.2 mhz, thus tuning to other values is not guaranteed. at 3v and 25 o c, the pre-programmed calibration byte gives a frequency within 1% of the nominal frequency. bit 76543210 $00 cal7 cal6 cal5 cal4 cal3 cal2 cal1 cal0 osccal read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000000 table 2. internal rc oscillator range osccal value min frequency max frequency 0x00 0.6 mhz 1.2 mhz 0x7f 0.8 mhz 1.7 mhz 0xff 1.2 mhz 2.5 mhz
10 attiny28l/v 1062f?avr?07/06 memories i/o memory the i/o space definition of the attiny28 is shown in table 3. note: reserved and unused locations are not shown in the table. all attiny28 i/o and peripherals are placed in the i/o space. the i/o locations are accessed by the in and out instructions tr ansferring data between the 32 general-pur- pose working registers and the i/o space. i/o registers within the address range $00 - $1f are directly bit-accessible using the sbi and cbi instructions. in these registers, the value of single bits can be checked by using the sbis and sbic instructions. refer to the instruction set section for more details. for compatibility with futu re devices, reserved bits should be written to ze ro if accessed. reserved i/o memory addresses should never be written. the i/o and peripherals control registers are explained in the following sections. table 3. attiny28 i/o space address hex name function $3f sreg status register $1b porta data register, port a $1a pacr port a control register $19 pina input pins, port a $16 pinb input pins, port b $12 portd data register, port d $11 ddrd data direction register, port d $10 pind input pins, port d $08 acsr analog comparator c ontrol and status register $07 mcucs mcu control and status register $06 icr interrupt control register $05 ifr interrupt flag register $04 tccr0 timer/counter0 control register $03 tcnt0 timer/counter0 (8-bit) $02 modcr modulation control register $01 wdtcr watchdog timer control register $00 osccal oscillator calibration register
11 attiny28l/v 1062f?avr?07/06 program and data addressing modes the attiny28 avr risc microcontroller supports powerful and efficient addressing modes. this section describes the different addressing modes supported in the attiny28. in the figures, op means the operation code part of the instruction word. to simplify, not all figures show the exact location of the addressing bits. register direct, single register rd figure 8. direct single register addressing the operand is contained in register d (rd). register indirect figure 9. indirect register addressing the register accessed is the one pointed to by the z-register (r31, r30). register direct, two registers rd and rr figure 10. direct register addressing, two registers registerfile 0 31 30 z-register
12 attiny28l/v 1062f?avr?07/06 operands are contained in register r (rr) and d (rd). the result is stored in register d (rd). i/o direct figure 11. i/o direct addressing operand address is contained in six bits of the instruction word. n is the destination or source register address. relative program addressing, rjmp and rcall figure 12. relative program memory addressing program execution continues at address pc + k + 1. the relative address k is -2048 to 2047. constant addressing using the lpm instruction figure 13. code memory constant addressing 15 0 pc 15 0 12 11 op k program memory $000 $3ff +1 $3ff 15 1 0 z-register program memory $000
13 attiny28l/v 1062f?avr?07/06 constant byte address is specified by the z-register contents. the 15 msbs select word address (0 - 1k), and lsb selects low byte if cleared (lsb = 0) or high byte if set (lsb = 1). memory access and instruction execution timing this section describes the general access timing concepts for instruction execution and internal memory access. the avr cpu is driven by the system clock, directly generated from the external clock crystal for the chip. no inter nal clock division is used. figure 14 shows the parallel instruction fetches and instruction executions enabled by the harvard architecture and the fast-access register file concept. this is the basic pipe- lining concept to obtain up to 1 mips per mhz with the corresponding unique results for functions per cost, functions per cl ocks and functions per power unit. figure 14. the parallel instruction fetches and instruction executions figure 15 shows the internal timing concept fo r the register file. in a single clock cycle an alu operation using two register operands is executed, and the result is stored back to the destination register. figure 15. single cycle alu operation flash program memory the attiny28 contains 2k bytes of on-chip flash memory for program storage. since all instructions are single 16-bit words, the flash is organized as 1k x 16 words. the flash memory has an endurance of at least 1,000 write/erase cycles. the attiny28 program counter is 10 bits wide, thus addressing the 1k word flash pro- gram memory. see ?programming the flash? on page 47 for a detailed description of flash data downloading. system clock ? 1st instruction fetch 1st instruction execute 2nd instruction fetch 2nd instruction execute 3rd instruction fetch 3rd instruction execute 4th instruction fetch t1 t2 t3 t4 system clock ? total execution time register operands fetch alu operation execute result write back t1 t2 t3 t4
14 attiny28l/v 1062f?avr?07/06 sleep modes to enter the sleep modes, the se bit in mcucs must be set (one) and a sleep instruc- tion must be executed. the sm bit in the mcucs register selects which sleep mode (idle or power-down) will be activated by the sleep instruction. if an enabled interrupt occurs while the mcu is in a sleep mode, the mcu awakes. the cpu is then halted for four cycles. it executes the interrupt routin e and resumes execution from the instruction following sleep. the contents of the register file and i/o memory are unaltered. if a reset occurs during sleep mode, the mcu wakes up and executes from the reset vector. idle mode when the sm bit is cleared (zero), the sleep instruction fo rces the mcu into the idle mode, stopping the cpu but allowing timer/counters, watchdog and the interrupt sys- tem to continue operating. this enables the mcu to wake up from external triggered interrupts as well as internal ones like timer overflow interrupt and watchdog reset. if wake-up from the analog comparator interrupt is not required, the analog comparator can be powered down by setting the acd bit in the analog comparator control and sta- tus register (acsr). this will reduce power consumption in idle mode. note that the acd bit is set by default. power-down mode when the sm bit is set (one), the sleep instruction forces the mcu into the power- down mode. in this mode, the external oscilla tor is stopped, while the external interrupts and the watchdog (if enabled) continue operating. only an external reset, a watchdog reset (if enabled), or an external level interrupt can wake up the mcu. note that if a level-triggered interrupt is used for wake-up from power-down mode, the changed level must be held for some time to wake up the mcu. this makes the mcu less sensitive to noise. the wake-up peri od is equal to the clock-counting part of the reset period (see table 5). the mcu will wake up from power-down if the input has the required level for two watchdog oscillator cy cles. if the wake-up pe riod is shorter than two watchdog oscillator cycles, the mcu will wake up if the input has the required level for the duration of the wake-up period. if the wake-up condition disappears before the wake-up period has expired, the mcu will wake up from pow er-down without executing the corresponding interrupt. the period of the watchdog osc illator is 2.7 s (nominal) at 3.0v and 25 c. the frequency of the watchdog oscillator is voltage-dependent as shown in the section ?typical characteristics? on page 57. when waking up from the power-down mode, there is a delay from the wake-up condi- tion until the wake-up becomes effective. this allows the clock to restart and become stable after having been stopped.
15 attiny28l/v 1062f?avr?07/06 system control and reset reset sources the attiny28 provides three sources of reset: ? power-on reset. the mcu is reset when the supply voltage is below the power-on reset threshold (v pot ). ? external reset. the mcu is reset when a low level is present on the reset pin for more than 50 ns. ? watchdog reset. the mcu is reset when the watchdog timer period expires and the watchdog is enabled. during reset, all i/o registers are then set to their initial values and the program starts execution from address $000. the instructio n placed in address $000 must be an rjmp (relative jump) instruction to the reset handling routine. if the program never enables an interrupt source, the interrupt vectors are not used, and regular program code can be placed at these locations. the circuit diagram in figure 16 shows the reset logic. table 4 defines the timing and electrical parameters of the reset circuitry. figure 16. reset logic note: 1. the power-on reset will not work unless the supply voltage has been below v pot (falling). table 4. reset characteristics symbol parameter min typ max unit v pot (1) power-on reset threshold voltage (rising) 1.0 1.4 1.8 v power-on reset threshold voltage (falling) 0.4 0.6 0.8 v v rst reset pin threshold voltage 0.6 v cc v power-on reset circuit reset circuit watchdog timer on-chip rc oscillator vcc reset 100 - 500k delay counters ck cksel[3..0] s r q full internal reset counter reset mcu control and status register (mcucs) porf extrf wdrf data bus
16 attiny28l/v 1062f?avr?07/06 note: 1. due to limited number of clock cycles in the start-up period, it is recommended that ceramic resonator be used. this table shows the start-up times from reset. from power-down mode, only the clock counting part of the star t-up time is us ed. the watchdog oscillator is used for timing the real-time part of the start-up time. the number wdt oscillator cycles used for each time-out is shown in table 6. the frequency of the watchdog oscillator is voltage-dependen t, as shown in the section ?typical characteristics? on page 57. the device is shipped with cksel = 0010. power-on reset a power-on reset (por) pulse is generated by an on-chip detection circuit. the detec- tion level is nominally 1.4v. the por is activated whenever v cc is below the detection level. the por circuit can be used to trigger the start-up reset, as well as detect a fail- ure in supply voltage. the power-on reset (por) circuit ensures that the device is reset from power-on. reaching the power-on reset threshold voltage invokes a delay counter, which deter- mines the delay for which the dev ice is kept in reset after v cc rise. the time-out period of the delay counter can be defined by the user through the cksel fuses. the different selections for the delay period are presented in table 5. the reset signal is table 5. attiny28 clock options and start-up time cksel3..0 clock source start-up time at 2.7v 1111 external crystal/ceramic resonator (1) 1k ck 1110 external crystal/ceramic resonator (1) 4.2 ms + 1k ck 1101 external crystal/ceramic resonator (1) 67 ms + 1k ck 1100 external crystal/ceramic resonator 16k ck 1011 external crystal/ceramic resonator 4.2 ms + 16k ck 1010 external crystal/ceramic resonator 67 ms + 16k ck 1001 external low-frequency crystal 67 ms + 1k ck 1000 external low-frequency crystal 67 ms + 32k ck 0111 external rc oscillator 6 ck 0110 external rc oscillator 4.2 ms + 6 ck 0101 external rc oscillator 67 ms + 6 ck 0100 internal rc oscillator 6 ck 0011 internal rc oscillator 4.2 ms + 6 ck 0010 internal rc oscillator 67 ms + 6 ck 0001 external clock 6 ck 0000 external clock 4.2 ms + 6 ck table 6. number of watchdog oscillator cycles time-out number of cycles 4.2 ms 1k 67 ms 16k
17 attiny28l/v 1062f?avr?07/06 activated again, without any delay, when the v cc decreases below detection level. see figure 17. if the built-in st art-up delay is sufficient, reset can be connected to vcc directly or via an external pull-up resistor. by holding the reset pin low for a period after v cc has been applied, the power-on reset period can be extended. refer to figure 18 for a tim- ing example of this. figure 17. mcu start-up, reset tied to vcc. figure 18. mcu start-up, reset controlled externally external reset an external reset is generate d by a low level on the reset pin. reset pulses longer than 50 ns will generate a reset, even if the cl ock is not running. shorter pulses are not guaranteed to generate a reset. when the applied voltage reaches the reset threshold voltage (v rst ) on its positive edge, the delay timer starts the mcu after the time-out period (t tout ) has expired. vcc reset time-out internal reset t tout v pot v rst vcc reset time-out internal reset t tout v pot v rst
18 attiny28l/v 1062f?avr?07/06 figure 19. external reset during operation watchdog reset when the watchdog times out, it will generate a short rese t pulse of 1 xtal cycle dura- tion. on the falling edge of this pulse, the delay timer starts counting the time-out period (t tout ). refer to page 37 for details on operation of the watchdog. figure 20. watchdog reset during operation vcc reset time-out internal reset t tout v rst
19 attiny28l/v 1062f?avr?07/06 register description mcu control and status register ? mcucs the mcu control and status register contains control and status bits for general mcu functions. ? bit 7 ? plupb: pull-up enable port b when the plupb bit is set (one), pull-up resi stors are enabled on all port b input pins. when plupb is cleared, the pull-ups are disabled. if any of the special functions of port b is enabled, the corresponding pull-up(s) is disabled, independent of the value of plupb. ? bit 6 ? res: reserved bit this bit is a reserved bit in the at tiny28 and always reads as zero. ? bit 5 ? se: sleep enable the se bit must be set (one) to make the mcu enter the sleep mode when the sleep instruction is executed. to avoid the mcu entering the sleep mode unless it is the pro- grammer?s purpose, it is recommended to set the sleep enable se bit just before the execution of the sleep instruction. ? bit 4 ? sm: sleep mode this bit selects between the two available sleep modes. when sm is cleared (zero), idle mode is selected as sleep mode. when sm is set (one), power-down mode is selected as sleep mode. for details, refer to ?sleep modes? below. ? bit 3 ? wdrf: watchdog reset flag this bit is set if a watchdog reset occurs. the bit is cleared by a power-on reset, or by writing a logical ?0? to the flag. ? bit 2 ? res: reserved bit this bit is a reserved bit in the at tiny28 and always reads as zero. ? bit 1 ? extrf: external reset flag this bit is set if an external reset occurs. the bit is cleared by a power-on reset, or by writing a logical ?0? to the flag. ? bit 0 ? porf: power-on reset flag this bit is set if a power-on reset occurs. the bit is cleared by writin g a logical ?0? to the flag. to make use of the reset flags to identify a reset condition, the user should read and then clear the flag bits in mcucs as early as possible in the program. if the register is cleared before another reset occurs, the source of the reset can be found by examining the reset flags. bit 76543210 $07 plupb ? se sm wdrf ? extrf porf mcucs read/write r/w r r/w r/w r/w r r/w r/w initial value 0 0 0 0 see bit desc. 0 see bit description
20 attiny28l/v 1062f?avr?07/06 interrupts reset and interrupt the attiny28 provides five different interrupt sources. these interrupts and the reset vector each have a separate program vector in the program memory space. all the inter- rupts are assigned to individual enable bits. in order to enable the interrupt, both the individual enable bit and the i-bit in the status register (sreg) must be set to one. the lowest addresses in the program memory space are automatically defined as the reset and interrupt vectors. th e complete list of vectors is shown in table 7. the list also determines the priority levels of the different interrupts. the lower the address, the higher the priority level. reset has the highest priority, and next is int0 ? the external interrupt request 0. the most typical and general program setup for the reset and interrupt vector addresses are: address labels code comments $000 rjmp reset ; reset handler $001 rjmp ext_int0 ; irq0 handler $002 rjmp ext_int1 ; irq1 handler $003 rjmp low_level ; low level input handler $004 rjmp tim0_ovf ; timer0 overflow handle $005 rjmp ana_comp ; analog comparator handle ; $006 main: xxx ; main program start ? ? ? ? interrupt handling the attiny28 has one 8-bit interrupt control register (icr). when an interrupt occurs, the global interrupt enable i-bit is cleared (zero) and all inter- rupts are disabled. the user software can set (one) the i-bit to enable nested interrupts. the i-bit is set (one) when a return from interrupt instruction (reti) is executed. when the program counter is vectored to the actual interrupt vector in order to execute the interrupt handling routine, hardware clears the corresponding flag that generated the interrupt. some of the interrupt flags can also be cleared by writing a logical ?1? to the flag bit position(s) to be cleared. table 7. reset and interrupt vectors vector no. program address source interrupt definition 1 $000 reset hardware pin, power-on reset and watchdog reset 2 $001 int0 external interrupt request 0 3 $002 int1 external interrupt request 1 4 $003 input pins low-level input on port b 5$004 timer0, ovf0 timer/counter0 overflow 6 $005 ana_comp analog comparator
21 attiny28l/v 1062f?avr?07/06 if an interrupt condition occurs when the corresponding interrupt enable bit is cleared (zero), the interrupt flag will be set and remembered until the interrupt is enabled or the flag is cleared by software. if one or more interrupt conditions occur when the global interrupt enable bit is cleared (zero), the corresponding inte rrupt flag(s) will be set and remembered un til the global interrupt enable bit is se t (one), and will be execut ed by order of priority. note that external level interrupt does not have a flag and will only be remembered for as long as the interrup t condition is active. note that the status register is not automatically stored when entering an interrupt rou- tine and restored when returning from an interrupt routine. this must be handled by software. interrupt response time the interrupt execution response for all the enabled avr interrupts is four clock cycles minimum. after four clock cycles the program vector address for the actual interrupt handling routine is executed. during this 4-clock-cycle period, the program counter (10 bits) is pushed onto the stack. the vector is normally a relative jump to the interrupt rou- tine, and this jump takes two clock cycles. if an interrupt occurs during execution of a multi-cycle instruction, this instruction is comple ted before the interrupt is served. if an interrupt occurs when the mcu is in sleep mode, the interrupt execution response time is increased by four clock cycles. a return from an interrupt handling routine ta kes four clock cycles. during these four clock cycles, the program counter (10 bits) is popped back from the stack, and the i-flag in sreg is set. when avr exits from an inte rrupt, it will always return to the main pro- gram and execute one more instruction before any pending interrupt is served. external interrupt the external interrupt is triggered by the int pins. observe that, if enabled, the interrupt will trigger even if the int pin is configured as an output. this feature provides a way of generating a software in terrupt. the exte rnal interrupt can be trig gered by a falling or ris- ing edge, a pin change or a low level. this is set up as indicated in the specification for the interrupt control register (icr). when the external interrupt is enabled and is con- figured as level-trig gered, the interrupt will trigger as long as the pin is held low. the external interrupt is set up as described in the specification for the interrupt control register (icr). low-level input interrupt the low-level interrupt is triggered by setting any of the port b pins low. however, if any port b pins are used for other special features, these pins will not trigger the interrupt. for example, if the analog co mparator is enabled, a low level on pb0 or pb1 will not cause an interrupt. this is also the case for the special functions t0, int0 and int1. if low-level interrupt is se lected, the low level mu st be held until the completion of the cur- rently executing instruction to generate an interrupt. when this interrupt is enabled, the interrupt will trigger as long as an y of the port b pins are held low.
22 attiny28l/v 1062f?avr?07/06 register description interrupt control register ? icr ? bit 7 ? int1: external interrupt request 1 enable when the int1 bit is set (one) and i-bit in the status register (sreg) is set (one), the external pin interrupt 1 is enabled. the interrupt sense control1 bits 1/0 (isc11 and isc10) define whether the external interrupt is activated on rising or falling edge, on pin change or low level of the int1 pin. the corresponding interrupt of external interrupt request 1 is executed from program memory address $002. see also ?external interrupt?. ? bit 6 ? int0: external interrupt request 0 enable when the int0 bit is set (one) and the i-bit in the status register (sreg) is set (one), the external pin interrupt 0 is enabled. the interrupt sense control0 bits 1/0 (isc01 and isc00) define whether the external interrupt is activated on rising or falling edge, on pin change or low level of the int0 pin. the corresponding interrupt of external interrupt request 0 is executed from program memory address $001. see also ?external interrupt?. ? bit 5 ? llie: low-level input interrupt enable when the llie is set (one) and the i-bit in the status register (sreg) is set (one), the interrupt on low-level input is activated. any of the port b pins pulled low will then cause an interrupt. however, if any port b pins are used for other special features, these pins will not trigger the interrupt. the correspond ing interrupt of low-level input interrupt request is executed from program memory address $003. see also ?low-level input interrupt?. ? bit 4 ? toie0: timer/counter0 overflow interrupt enable when the toie0 bit is set (one) and the i-bit in the status register is set (one), the timer/counter0 overflow interrupt is enabled. the corresponding interrupt (at vector $004) is executed if an overflow in timer/counter0 occurs, i.e., when the tov0 bit is set in the interrupt flag register (ifr). ? bits 3, 2 ? isc11, isc10: interrupt sense control 1 bit 1 and bit 0 the external interrupt 1 is activated by the external pin int1 if the sreg i-flag and the corresponding interrupt enable are set. the level and edges on the external int1 pin that activate the interrupt are defined in table 8. bit 76543210 $06 int1 int0 llie toie0 isc11 isc10 isc01 isc00 icr read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000000
23 attiny28l/v 1062f?avr?07/06 note: when changing the isc11/isc10 bits, int1 must be disabled by clearing its interrupt enable bit. otherwise, an interrupt can occur when the bits are changed. ? bits 1, 0 ? isc01, isc00: interrupt sense control 0 bit 1 and bit 0 the external interrupt 0 is activated by the external pin int0 if the sreg i-flag and the corresponding interrupt enable are set. the level and edges on the external int0 pin that activate the interrupt are defined in table 9. note: when changing the isc01/isc00 bits, int0 must be disabled by clearing its interrupt enable bit. otherwise, an interrupt can occur when the bits are changed. the value on the int pins are sampled before detecting edges. if edge interrupt is selected, pulses that last longer than one cpu clock period will generate an interrupt. shorter pulses are not guaranteed to generate an interrupt. if low-level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. if enabled, a level-triggered interrupt will generate an interrupt request as long as the pin is held low. interrupt flag register ? ifr ? bit 7 ? intf1: external interrupt flag1 when an edge on the int1 pin triggers an interrupt request, the corresponding interrupt flag, intf1 becomes set (one). if the i-bit in sreg and the corresponding interrupt enable bit, int1 in gimsk is set (one), the mcu will jump to the interrupt vector. the flag is cleared when the interrupt routine is executed. alternatively, the flag can be cleared by writing a logical ?1? to it. this fl ag is always cleared when int1 is configured as level interrupt. ? bit 6 ? intf0: external interrupt flag0 when an edge on the int0 pin triggers an interrupt request, the corresponding interrupt flag, intf0 becomes set (one). if the i-bit in sreg and the corresponding interrupt table 8. interrupt 1 sense control isc11 isc10 description 0 0 the low level of int1 generates an interrupt request. 0 1 any change on int1 generates an interrupt request. 1 0 the falling edge of int1 generates an interrupt request. 1 1 the rising edge of int1 generates an interrupt request. table 9. interrupt 0 sense control isc01 isc00 description 0 0 the low level of int0 generates an interrupt request. 0 1 any change on int0 generates an interrupt request. 1 0 the falling edge of int0 generates an interrupt request. 1 1 the rising edge of int0 generates an interrupt request. bit 76543210 $05 intf1intf0?tov0????ifr read/write r/w r/w r r/w r r r r initial value00000000
24 attiny28l/v 1062f?avr?07/06 enable bit, int0 in gimsk is set (one), the mcu will jump to the interrupt vector. the flag is cleared when the interrupt routine is executed. alternatively, the flag can be cleared by writing a logical ?1? to it. this fl ag is always cleared when int0 is configured as level interrupt. ? bit 5 ? res: reserved bit this bit is a reserved bit in the at tiny28 and always reads as zero. ? bit 4 ? tov0: timer/counter0 overflow flag the bit tov0 is set (one) when an overflow occurs in timer/counter0. tov0 is cleared by hardware when executing the corresponding interrupt handling vector. tov0 is cleared by writing a logical ?1? to the flag. when the sreg i-bit, toie0 in icr and tov0 are set (one), the timer/counter0 overflow interrupt is executed. ? bit 3..0 - res: reserved bits these bits are reserved bits in the attiny28 and always read as zero. note: 1. one should not try to use the sbi (set bit in i/o register) instruction to clear individ- ual flags in the register. this will result in clearing all the flags in the register, because the register is first read, then modified and finally written, thus writing ones to all set flags. using the cbi (clear bit in i/o register) instruction on ifr will result in clearing all bits apart from the specified bit.
25 attiny28l/v 1062f?avr?07/06 i/o ports all avr ports have true read-modify-write functionality when used as general digital i/o ports. this means that the direction of one port pin can be changed without unintention- ally changing the direction of any other pin with the sbi and cbi instructions. the same applies for changing drive value (if configured as output) or enabling/disabling of pull-up resistors (if configured as input). port a port a is a 4-bit i/o port. pa3, pa1, and pa0 are bi-directional, while pa2 is output-only. before entering power-down, see ?sleep modes? on page 14, porta2 bit in porta register should be set. three i/o memory address locations are allocated for port a, one each for the data register ? porta, $1b, port a control regi ster ? pacr, $1a and the port a input pins ? pina, $19. the port a input pins address is read-only, while the data register and the control register are read/write. compared to other output ports, the port a output is delayed one extra clock cycle. port pins pa0, pa1 and pa3 have individual ly selectable pull-up resistors. when pins pa0, pa1 or pa3 are used as inputs and are externally pulled low, they will source cur- rent if the internal pull-up resistors are activated. pa2 is output-only. the pa2 output buffer can sink 25 ma and thus drive a high-current led directly. this output can also be modulated (see ?hardware modulator? on page 39 for details). port a as general digital i/o pa3, pa1 and pa0 are general i/o pins. the ddan (n: 3,1,0) bits in pacr select the direction of these pins. if ddan is set (one), pan is configured as an output pin. if ddan is cleared (zero), pan is configured as an input pin. if portan is set (one) when the pin is configured as an input pin, the mos pull-up resistor is activated. to switch the pull-up resistor off, the portan bit has to be cleared (zero) or the pin has to be configured as an output pin. the effects of the ddan and portan bits on pa3, pa1 and pa0 are shown in table 10. the port pins are tri-stated when a reset condition becomes active, even if the clock is not running. note: n: 3,1,0, pin number alternate function of pa2 pa2 is the built-in, high-current led driver and it is always an output pin. the output sig- nal can be modulated with a software programmable frequency. see ?hardware modulator? on page 39 for further details. table 10. ddan effects on port a pins ddan portan i/o pull-up comment 0 0 input no tri-state (high-z) 0 1 input yes pan will source current if ext. pulled low. 1 0 output no push-pull zero output 1 1 output no push-pull one output
26 attiny28l/v 1062f?avr?07/06 port a schematics note that all port pins are synchronized. the synchronization latches are, however, not shown in the figures. figure 21. port a schematic diagram (pins pa0, pa1 and pa3) figure 22. port a schematic diagram (pin pa2) data bus d d q q reset reset c c wd wp rd pan wp: wd: rl: rp: rd: n: write porta write ddra read porta latch read porta pin read ddra 0,1,3 ddan portan rl rp mos pull- up d q reset r c r r data bus d q reset c wp wp: rl: write porta read porta latch porta2 rl 1 0 hardware modulator pa2 d q reset c oom01 0 0 1 1 oom00 0 1 0 1 disable toggle clear set tov0 fov0 r note: both the flip-flops shown have reset value one (set). r
27 attiny28l/v 1062f?avr?07/06 port b port b is an 8-bit input port. one i/o address location is allocated for the port b input pins ? pinb, $16. the port b input pins address is read-only. all port pins have pull-ups that can be switched on for all port b pins simultaneously. if any of the port b special functions is enabl ed, the corresponding pull-up(s) is disabled. when pins pb0 to pb7 are externally pulled low, they will source cu rrent (i il ) if the inter- nal pull-up resistors are activated. the port b pins with alternate functions are shown in table 11. port b as general digital input all eight pins in port b have equal func tionality when used as digital input pins. pbn, general input pin: to switch the pull-up resistors on, the plupb bit in the mcucs register must be set (one). this bit controls the pull-up on all port b pins. to turn the pull-ups off, this bit has to be cleared (zero). note that if any port b pins are used for alternate functions, the pull-up on the corres ponding pins are disabled. the port pins are tri-stated when a reset condition becomes active, even if the clock is not running. alternate functions of port b all port b pins are connected to a low-level detector that can trigger the low-level input interrupt. see ?low-level input interrupt? on page 21 for details. in addition, port b has the following alternate functions: ? int1 ? port b, bit 4 int1, external interrupt source 1. the pb4 pi n can serve as an external interrupt source to the mcu. see the interrupt description for details on how to enable and configure this interrupt. if the interrupt is en abled, the pull-up re sistor on pb4 is disabled and pb4 will not give low-level interrupts. ? int0 ? port b, bit 3 int0, external interrupt source 0. the pb3 pi n can serve as an external interrupt source to the mcu. see the interrupt description for details on how to enable and configure this interrupt. if the interrupt is en abled, the pull-up re sistor on pb3 is disabled and pb3 will not give low-level interrupts. ? t0 ? port b, bit 2 t0, timer/counter0 counter source. see the timer description for further details. if t0 is used as the counter source, th e pull-up resistor on pb2 is disabled and pb2 will not give low-level interrupts. table 11. port b pin alternate functions port pin alternate functions pb0 ain0 (analog comparator positive input) pb1 ain1 (analog comparator negative input) pb2 t0 (timer/counter 0 external counter input) pb3 int0 (external interrupt 0 input) pb4 int1 (external interrupt 1 input)
28 attiny28l/v 1062f?avr?07/06 ? ain1 ? port b, bit 1 ain1, analog comparator negative input. when the on-chip analog comparator is enabled, this pin also serves as the negative input of the comparator. if the analog com- parator is enabled, the pull- up resistors on pb1 and pb0 are disabled and these pins will not give low-level interrupts. ? ain0 ? port b, bit 0 ain0, analog comparator positive input. when the on-chip analog comparator is enabled, this pin also serves as the positive input of the comparator. if the analog com- parator is enabled, the pull- up resistors on pb1 and pb0 are disabled and these pins will not give low-level interrupts. port b schematics note that all port pins are synchronized. the synchronization latches are, however, not shown in the figures. figure 23. port b schematic diagram (pins pb0 and pb1) da ta bus mos pull- up pbn rp: read portb pin n : 0, 1 pull-up port b comparator disable rp to low-level detector to comparator ainn pwrdn
29 attiny28l/v 1062f?avr?07/06 figure 24. port b schematic diagram (pin pb2) figure 25. port b schematic diagram (pins pb3 and pb4) data bus mos pull- up pb2 rp: read portb pin pull-up port b rp to low-level detector sense control timer0 clock source mux cs02 cs01 cs00 data bus mos pull- up pbn rp: read portb pin n : 3, 4 m : 0, 1 pull-up port b rp to low-level detector sense control intm iscm1 iscm0 intm enable
30 attiny28l/v 1062f?avr?07/06 figure 26. port b schematic diagram (pins pb7 - pb5) port d port d is an 8-bit bi-directional i/o port with internal pull-up resistors. three i/o memory address locations are allocated for port d, one each for the data register ? portd, $12, data direction r egister ? ddrd, $11 and the port d input pins ? pind, $10. the port d input pins address is read-only, while the data register and the data direction register are read/write. the port d output buffers can sink 10 ma. as inputs, port d pins that are externally pulled low will source current if t he pull-up resistor s are activated. port d as general digital i/o all eight pins in port d have equal fu nctionality when used as digital i/o pins. pdn, general i/o pin: the dddn bit in the ddrd register selects the direction of this pin. if dddn is set (one), pdn is configured as an output pin. if dddn is cleared (zero), pdn is configured as an input pin. if pdn is set (one) when configured as an input pin, the mos pull-up resistor is activated. to switch the pull-up resistor off, the pdn has to be cleared (zero), or the pin has to be configur ed as an output pin. the port pins are tri- stated when a reset condition becomes active, even if the clock is not running. note: n: 7,6,...,0, pin number data bus pbn to low-level detector rp: n: read port b pin 5 - 7 rp mos pull- up pull-up port b table 12. dddn bits on port d pins dddn portdn i/o pull-up comment 0 0 input no tri-state (high-z) 0 1 input yes pdn will source current if ext. pulled low 1 0 output no push-pull zero output 1 1 output no push-pull one output
31 attiny28l/v 1062f?avr?07/06 figure 27. port d schematic diagram (pins pd7 - pd0) data bus d d q q reset reset c c wd wp rd mos pull- up pdn r r wp: wd: rl: rp: rd: write portd write ddrd read portd latch read portd pin read ddrd dddn portdn rl rp n : 0 - 7
32 attiny28l/v 1062f?avr?07/06 register description port a data register ? porta port a control register ? pac r ? bits 7..4 ? res: reserved bits these bits are reserved bits in the attiny28 and always read as zero. ? bit 3 ? dda3: data direction pa3 when dda3 is set (one), the corresponding pin is an output pin. otherwise, it is an input pin. ? bit 2 ? pa2hc: porta2 high current enable when the pa2hc bit is set (one), an additional driver at the output pin pa2 is enabled. this makes it possible to sink 25 ma at v cc = 1.8v (v ol = 0.8v). when the pa2hc bit is cleared (zero), pa2 can sink 15 ma at v cc = 1.8v (v ol = 0.8v). ? bits 1, 0 ? dda1, dda0: data direction pa1 and pa0 when ddan is set (one), the corresponding pin is an output pin. otherwise, it is an input pin. port a input pins address ? pina the port a input pins address (pina) is not a register; this address enables access to the physical value on each port a pin. when reading porta, the port a data latch is read and when reading pina, the logical values present on the pins are read. port b input pins address ? pinb the port b input pins address (pinb) is not a register; this address enables access to the physical value on each port b pin. when reading pinb, the logical values present on the pins are read. bit 76543210 $1b ????porta3porta2porta1porta0porta read/writerrrrr/wr/wr/wr/w initial value00000100 bit 76543210 $1a ????dda3pa2hcdda1dda0pacr read/writerrrrr/wr/wr/wr/w initial value00000000 bit 76543210 $19 ????pina3?pina1pina0pina read/writerrrrrrrr initial value0000n/a0n/an/a bit 76543210 $16 pinb7 pinb6 pinb5 pinb4 pi nb3 pinb2 pinb1 pinb0 pinb read/write rrrrrrrr initial value n/a n/a n/a n/a n/a n/a n/a n/a
33 attiny28l/v 1062f?avr?07/06 port d data register ? portd port d data direction register ? ddrd port d input pins address ? pind the port d input pins address (pind) is no t a register; this address enables access to the physical value on each port d pin. when reading portd, the port d data latch is read and when reading pind, the logical values present on the pins are read. bit 76543210 $12 portd7 portd6 portd5 portd4 portd3 portd2 portd1 portd0 portd read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000000 bit 76543210 $11 ddd7 ddd6 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 ddrd read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000000 bit 76543210 $10 pind7 pind6 pind5 pind4 pi nd3 pind2 pind1 pind0 pind read/writerrrrrrrr initial value n/a n/a n/a n/a n/a n/a n/a n/a
34 attiny28l/v 1062f?avr?07/06 timer/counter0 the attiny28 provides one general-purpose 8-bit timer/counter ? timer/counter0. timer/counter0 has prescaling selection from the 10-bit prescaling timer. the timer/counter0 can either be used as a timer with an internal clock time base or as a counter with an external pin connection that triggers the counting. timer/counter prescaler figure 28 shows the timer/counter prescaler. figure 28. timer/counter0 prescaler the four different prescaled selections are: the hardware modulator period, ck/64, ck/256 and ck/1028, wher e ck is the oscillator clock. ck, external source and stop can also be selected as clock sources. figure 29 shows the block diagram for timer/counter0. figure 29. timer/counter0 block diagram 10-bit t/c prescaler 0 timer/counter0 clock source tck0 ck t0 cs00 cs01 cs02 ck/256 ck/1024 ck/64 count enable from modulator t/c0 over- flow irq interrupt flag register (ifr) t/c0 control register (tccr0) timer/counter0 (tcnt0) control logic tov0 interrupt control register (icr) toie0 tov0 t0
35 attiny28l/v 1062f?avr?07/06 the 8-bit timer/counter0 can select clock source from ck, prescaled ck or an external pin. in addition, it can be stopped as de scribed in the specification for the timer/counter0 control register (tccr0). the overflow status flag is found in the inter- rupt flag register (ifr). control signals are found in the timer/counter0 control register (tccr0). the interrupt enable/disabl e setting for timer/counter0 is found in the interrupt control register (icr). when timer/counter0 is externally clocked, the external signal is synchronized with the oscillator frequency of the cpu. to ensure proper samp ling of the external clock, the minimum time between two external clock transitions must be at least one internal cpu clock period. the external clock signal is sampled on the rising edge of the internal cpu clock. the 8-bit timer/counter0 features both a high-resolution and a high-accuracy usage with the lower prescaling opportunities. similarly, the high prescaling opportunities make the timer/counter0 useful for lower speed functions or exact timing functions with infre- quent actions. register description timer/counter0 control register ? tccr0 ? bit 7 ? fov0: force overflow writing a logical ?1? to this bit forces a change on the overflow output pin pa2 according to the values already set in oom01 and oom00. if the oom01 and oom00 bits are written in the same cycle as fov0, the new settings will not take effect until the next overflow or forced overflow occurs. the force overflow bit can be used to change the output pin without waiting for an overflow in the timer. the automatic action programmed in oom01 and oom00 happens as if an overflow had occurred, but no interrupt is gen- erated. the fov0 bit will a lways read as zero, a nd writing a zero to th is bit has no effect. ? bits 6, 5 ? res: reserved bits these bits are reserved bits in the attiny28 and always read as zero. ? bits 4, 3 ? oom01, oom00: overflow output mode, bits 1 and 0 the oom01 and oom00 control bits determine any output pin action following an over- flow or a forced overflow in timer/counter0. any output pin actions affect pin pa2. the control configuration is shown in table 13. bit 7 6 5 4 3 210 $04 fov0 ? ? oom01 oom00 cs02 cs01 cs00 tccr0 read/write r/w r r r/w r/w r/w r/w r/w initial value 0 0 0 0 0 0 0 0 table 13. overflow output mode select oom01 oom00 description 0 0 timer/counter0 disconnected from output pin pa2 0 1 toggle the pa2 output line. 1 0 clear the pa2 output line to zero. 1 1 set the pa2 output line to one.
36 attiny28l/v 1062f?avr?07/06 ? bits 2, 1, 0 ? cs02, cs01, cs00: clock select0, bits 2, 1 and 0 the clock select0 bits 2, 1 and 0 define the prescaling source of timer/counter0. the stop condition provides a timer en able/disable function. the ck down divided modes are scaled directly from the ck oscillator clock. if the external pin modes are used for timer/counter0, transi tions on pb2/(t0) will clock t he counter even if the pin is configured as an output. this feature can give the user software control of the counting. timer counter 0 ? tcnt0 the timer/counter0 is realized as an up-counter with read and write access. if the timer/counter0 is written and a clock source is present, the timer/counter0 continues counting in the timer clock cycle following the write operation. table 14. clock 0 prescale select cs02 cs01 cs00 description 0 0 0 stop, the timer/counter0 is stopped. 001ck 0 1 0 modulator period 011ck/64 100ck/256 1 0 1 ck/1024 1 1 0 external pin t0, falling edge 1 1 1 external pin t0, rising edge bit 76543210 $03 msb lsb tcnt0 read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000000
37 attiny28l/v 1062f?avr?07/06 watchdog timer the watchdog timer is clocked from a s eparate on-chip oscillato r. by controlling the watchdog timer prescaler, the watchdog re set interval can be adjusted as shown in table 15. see characterization data for typical values at other v cc levels. the wdr (watchdog reset) instruction resets the watchdog timer. eight different clock cycle periods can be selected to determine the reset period. if the reset period expires without another watchdog reset, the attiny28 resets and executes from the reset vector. for timing details on the watchdog reset, refer to page 18. to prevent unintentional disabling of the watchdog, a special turn-off sequence must be followed when the watchdog is disabled. refer to the description of the watchdog timer control register for details. figure 30. watchdog timer register description watchdog timer control register ? wdtcr ? bits 7..5 - res: reserved bits these bits are reserved bits in the attiny28 and will always read as zero. ? bit 4 ? wdtoe: watchdog turn-off enable this bit must be set (one) when the wde bit is cleared. otherwise, the watchdog will not be disabled. once set, hardware will clear this bit to zero after four clock cycles. refer to the description of the wde bit for a watchdog disable procedure. ? bit 3 ? wde: watchdog enable when the wde is set (one), the watchdog timer is enabled and if the wde is cleared (zero), the watchdog timer function is disabled. wde can only be cleared if the wdtoe bit is set (one). to disable an enabled watchdog timer, the following proce- dure must be followed: 1 mhz at v cc = 5v 350 khz at v cc = 3v 110 khz at v cc = 2v oscillator bit 765 4 3210 $01 ? ? ? wdtoe wde wdp2 wdp1 wdp0 wdtcr read/write r r r r/w r/w r/w r/w r/w initial value 0 0 0 0 0 0 0 0
38 attiny28l/v 1062f?avr?07/06 1. in the same operation, write a logical ?1? to wdtoe and wde. a logical ?1? must be written to wde even though it is set to one before the disable operation starts. 2. within the next four clock cycles, write a logical ?0? to wde. this disables the watchdog. ? bits 2..0 ? wdp2, wdp1, wdp0: watchdog timer prescaler 2, 1 and 0 the wdp2, wdp1 and wdp0 bits determine the watchdog timer prescaling when the watchdog timer is enabled. the different prescaling values and their corresponding time-out periods are shown in table 15. note: the frequency of the watchdog oscillator is voltage-dependent, as shown in the section ?typical characteristics? on page 57. the wdr (watchdog reset) instruction shou ld always be executed before the watchdog timer is enabled. this ensures that the reset period will be in accordance with the watchdog timer prescale settings. if the watchdog timer is enabled without reset, the watchdog timer may not start counting from zero. table 15. watchdog timer prescale select wdp2 wdp1 wdp0 number of wdt oscillator cycles typical time-out at v cc = 2.0v typical time-out at v cc = 3.0v typical time-out at v cc = 5.0v 0 0 0 16k cycles 0.15 s 47 ms 15 ms 0 0 1 32k cycles 0.30 s 94 ms 30 ms 0 1 0 64k cycles 0.60 s 0.19 s 60 ms 0 1 1 128k cycles 1.2 s 0.38 s 0.12 s 1 0 0 256k cycles 2.4 s 0.75 s 0.24 s 1 0 1 512k cycles 4.8 s 1.5 s 0.49 s 1 1 0 1,024k cycles 9.6 s 3.0 s 0.97 s 1 1 1 2,048k cycles 19 s 6.0 s 1.9 s
39 attiny28l/v 1062f?avr?07/06 hardware modulator attiny28 features a built-in hardware modulator connected to a high-current output pad, pa2. the hardware modulator generates a configurable pulse train. the on-time of a pulse can be set to a number of chip clock cycles. this is done by configuring the modu- lation control register (modcr). pa2 is the built-in, high-current led driver and it is always an output pin. the output buffer can sink 25 ma at v cc = 2.0v. when mconf is zero, modulation is switched off and the pin acts as a normal high-current ou tput pin. the following truth table shows the effect of various porta2 and mconf settings. the modulation period is available as a prescale to timer/counter0 and thus, this timer should be used to time the length of each burst. if the number of pulses to be sent is n, the number 255 - n should be loaded to the timer. when an overflow occurs, the trans- mission is complete.the oom01 and oom00 bits in tccr0 can be configured to automatically change the value on pa2 when a timer/counter0 overflow occurs. see ?timer/counter0? on page 34 for details on how to configure the oom01 and oom00 bits. the modulation period is available as a prescale even when porta2 is high and mod- ulation is stopped. thus, this prescale can also be used to time the intervals between bursts. to get a glitch-free output, the user should first configure the modcr register to enable modulation. there are two ways to start the modulation: 1. clear the porta2 bit in port a data register (porta). 2. configure oom00 and oom01 bits in the timer/counter0 control register (tccr0) to clear pa2 on the next overflow. either an overflow or a forced over- flow can then be used to start modulation. the pa2 output will then be se t low at the start of the next cycle. to stop the modulated output, the user should set the porta2 bit or configure oom00 and oom01 to set pa2 on the next overflow. if the modcr register is changed during modulation, the changed value will take effect at the start of the next cycle, producing a glitch-free output. see figure 31 below and figure 22 on page 26. table 16. pa2 output porta2 mconf pa2 output 000 0 1 - 7 modulated 1x1
40 attiny28l/v 1062f?avr?07/06 figure 31. the hardware modulator figure 32 to figure 35 show examples on output from the modulator. figure 32 also shows the timing for the enable setting signal and for the count enable signal to timer/counter0. figure 32. modulation with ontim = 3, mconf = 010. note: 1. clock frequency: 455 khz; modulat ion frequency: 38 khz; duty-cycle: 33% figure 33. modulation with ontim = 5, mconf = 001 note: clock frequency: 455 khz; modulati on frequency: 38 khz; duty-cycle: 50% disable modualtor pa2 0 1 dq iporta2 from porta2 enable setting modulator state machine count enable to timer/counter0 iontim imconf 5 ontim mconf 3 rm wm 8 5 3 5 3 / / / / / / / wm: write modcr rm: read modcr clk pa 2 count enable enable setting clk pa 2
41 attiny28l/v 1062f?avr?07/06 figure 34. modulation with ontim = 1, mconf = 011 note: clock frequency: 3.64 mhz; modulation frequency: 455 khz; duty-cycle: 25% figure 35. modulation with ontim = 3, mconf = 001 note: clock frequency: 3.64 mhz; modulation frequency: 455 khz; duty-cycle: 50% table 17. some common modulator configurations crystal/resonator frequency carrier frequency % error in frequency duty-cycle ontim value mconf value 455 khz 38 khz 0.2 25% 2 011 455 khz 38 khz 0.2 33% 3 010 455 khz 38 khz 0.2 50% 5 001 455 khz 38 khz 0.2 67% 3 100 455 khz 38 khz 0.2 75% 2 101 1 mhz 38 khz 1.2 50% 12 001 1.8432 mhz 38 khz 1.1 25% 11 011 1.8432 mhz 38 khz 1.1 33% 15 010 1.8432 mhz 38 khz 1.1 50% 23 001 2 mhz 38 khz 1.2 25% 12 011 2 mhz 38 khz 1.2 50% 25 001 2.4576 mhz 38 khz 1.1 50% 31 001 3.2768 mhz 38 khz 2.0 25% 21 011 4 mhz 38 khz 1.2 25% 25 011 455 khz 455 khz 0.0 approx. 50% x 111 1 mhz 455 khz 9.9 50% 0 001 1.82 mhz 455 khz 0.0 25% 0 011 1.82 mhz 455 khz 0.0 50% 1 001 1.8432 mhz 455 khz 1.3 25% 0 011 1.8432 mhz 455 khz 1.3 50% 1 001 2 mhz 455 khz 9.9 25% 0 011 clk pa 2 clk pa 2
42 attiny28l/v 1062f?avr?07/06 2 mhz 455 khz 9.9 50% 1 001 2.4576 mhz 455 khz 10.0 33% 1 010 2.4576 mhz 455 khz 10.0 50% 2 001 3.2768 mhz 455 khz 10.0 25% 1 011 3.2768 mhz 455 khz 10.0 50% 3 001 3.64 mhz 455 khz 0.0 25% 1 011 3.64 mhz 455 khz 0.0 50% 3 001 4 mhz 455 khz 9.9 25% 1 011 4 mhz 455 khz 9.9 50% 3 001 table 17. some common modulator configurations (continued) crystal/resonator frequency carrier frequency % error in frequency duty-cycle ontim value mconf value
43 attiny28l/v 1062f?avr?07/06 register description modulation control register ? modcr ? bits 7..3 ? ontim4..0: modulation on-time this 5-bit value +1 determines the number of clock cycles the output pin pa2 is active (low). ? bits 2..0 ? mconf2..0: modulati on configuration bits 2, 1 and 0 these three bits determine the relationship between the on- and off-times of the modu- lator, and thereby the duty-cycle. the various settings are shown in table 18. the minimum and maximum modulati on period is also shown in the table. the minimum modulation period is obtained by setting ontim to zero, while the maximum period is obtained by setting ontim to 31. the configuration values for some common oscillator and carrier frequencies are listed in table 17. the relationship between oscillator fre- quency and carrier frequency is: if the mconf register is set to 111, the ca rrier frequency will be equal to the oscillator frequency. note: in the high-frequency mode, the output is gated with the clock signal. thus, the on- and off-times will be dependent on th e clock input to the mcu. also note that when changing from this mo de directly to another modulation mode, the output will have a small glitch. thus, pa2 should be set to stop the modulated output before changing from this mode. bit 76543 2 1 0 $02 ontim4 ontim3 ontim2 ontim1 ontim0 mconf2 mconf1 mconf0 modcr read/write r/w r/w r/w r/w r/w r/w r/w r/w initial value00000 0 0 0 fcarrier fosc on-time off-time + () ----------------------------------------------------- = table 18. mconf2..0 effect on duty-cycle and modulation period mconf2..0 on-time off-time duty-cyc le min period max period comment 000 x x 100% x x unmodulated output 001 ontim+1 ontim+1 50% 2 ck 64 ck 010 ontim+1 2 x (ontim+1) 33% 3 ck 96 ck 011 ontim+1 3 x (ontim+1) 25% 4 ck 128 ck 100 2 x (ontim+1) ontim+1 67% 3 ck 96 ck 101 3 x (ontim+1) ontim+1 75% 4 ck 128 ck 110 reserved 111 x x note 1 1 ck 1 ck high-frequency output
44 attiny28l/v 1062f?avr?07/06 analog comparator the analog comparator compares the input values on the positive input pb0 (ain0) and negative input pb1 (ain1). when the voltage on the positive input pb0 (ain0) is higher than the voltage on the negative input pb1 (ain1), the analog comparator output (aco) is set (one). the comparator can trigger a separate interrupt exclusive to the ana- log comparator. the user can select interrupt triggering on comparator output rise, fall or toggle. a block diagram of the comparator and its surrounding logic is shown in figure 36 . figure 36. analog comparator block diagram register description analog comparator control and status register ? acsr ? bit 7 ? acd: analog comparator disable when this bit is set (one), the power to the analog comparator is switched off. this bit can be set at any time to turn off the analog comparator. when changing the acd bit, the analog comparator interrupt must be disabled by clearing the acie bit in acsr. otherwise, an interrupt can occur when the bit is changed. to use the analog compara- tor, the user must clear this bit. ? bit 6 ? res: reserved bit this bit is a reserved bit in the at tiny28 and will always read as zero. ? bit 5 ? aco: analog comparator output aco is directly connected to the comparator output. ? bit 4 ? aci: analog comparator interrupt flag this bit is set (one) when a comparator output event triggers the interrupt mode defined by aci1 and aci0. the analog comparator in terrupt routine is executed if the acie bit is set (one) and the i-bit in sreg is set (one ). aci is cleared by hardware when execut- pb0 pb1 bit 76543210 $08 acd ? aco aci acie ? acis1 acis0 acsr read/write r/w r r r/w r/w r r/w r/w initial value 1 0 x 0 0 0 0 0
45 attiny28l/v 1062f?avr?07/06 ing the corresponding interrupt handling vector. alternatively, aci is cleared by writing a logical ?1? to the flag. ? bit 3 ? acie: analog comparator interrupt enable when the acie bit is set (one) and the i-bit in the status register is set (one), the ana- log comparator interrupt is activated. when cleared (zero), the interrupt is disabled. ? bit 2 ? res: reserved bit this bit is a reserved bit in the at tiny28 and will always read as zero. ? bits 1, 0 - acis1, acis0: analog comparator interrupt mode select these bits determine which comparator events trigger the analog comparator interrupt. the different settings are shown in table 19. note: when changing the acis1/acis0 bits, the analog comparator interrupt must be dis- abled by clearing its interrupt enable bit in the acsr register. otherwise, an interrupt can occur when the bits are changed. caution: using the sbi or cbi instruction on bits other than aci in th is register will write a one back into aci if it is read as set, thus clearing the flag. table 19. acis1/acis0 settings acis1 acis0 interrupt mode 0 0 comparator interrupt on output toggle 01reserved 1 0 comparator interrupt on falling output edge 1 1 comparator interrupt on rising output edge
46 attiny28l/v 1062f?avr?07/06 memory programming program memory lock bits the attiny28 mcu provides two lock bits that can be left unprogrammed (?1?) or can be programmed (?0?) to obtain the additional features listed in table 20. the lock bits can only be erased with the chip erase command. note: 1. further programming of the fuse bits is also disabled. program the fuse bits before programming the lock bits. fuse bits the attiny28 has five fuse bits, intcap and cksel3..0. ? when the intcap fuse is programmed (?0?), internal load capacitors are connected between xtal1/xtal2 and gnd, similar to c1 and c2 in figure 5. see ?crystal oscillator? on page 7. de fault value is unprogrammed (?1?). ? cksel3..0 fuses: see table 1, ?device clocking option select,? on page 7 and table 5, ?attiny28 clock options and start-up time,? on page 16, for which combination of cksel3..0 to use. default va lue is ?0010?, internal rc oscillator with long start-up time. the status of the fuse bits is not affected by chip erase. signature bytes all atmel microcontrollers have a 3-byte signature code that identifies the device. the three bytes reside in a separate address space. for the attiny28, they are: 1. $000: $1e (indicates manufactured by atmel) 2. $001: $91 (indicates 2 kb flash memory) 3. $002: $07 (indicates attiny28 device when signature byte $001 is $91) calibration byte the attiny28 has one byte calibration value for the internal rc oscillator. this byte resides in the high byte of address $000 in the signature address space. during memory programming, the external programmer must read this location, and program it into a selected location in the the normal flash program memory. at start-up, the user soft- ware must read this flash location a nd write the value to the osccal register. table 20. lock bit protection modes memory lock bits protection type mode lb1 lb2 1 1 1 no memory lock features enabled. 2 0 1 further programming of the flash is disabled. (1) 3 0 0 same as mode 2, and verify is also disabled.
47 attiny28l/v 1062f?avr?07/06 programming the flash atmel?s attiny28 offers 2k bytes of flash program memory. the attiny28 is shipped with the on-chip flash program memory array in the erased state (i.e., contents = $ff) and ready to be programmed. this device supports a high- voltage (12v) parallel programming mode. only minor currents (<1ma) are drawn from the +12v pin during programming. the program memory array in the attiny28 is programmed byte-by-byte. during pro- gramming, the supply voltage must be in accordance with table 21. parallel programming this section describes how to parallel program and verify flash program memory, lock bits and fuse bits in the attiny28. signal names in this section, some pins of the attiny 28 are referenced by signal names describing their function during parallel programming. see figure 37 and table 22. pins not described in table 22 are referenced by pin name. the xa1/xa0 pins determine the action executed when the xtal1 pin is given a posi- tive pulse. the coding is shown in table 23. when pulsing wr or oe , the command loaded determines the action executed. the command is a byte where the different bits are assigned functions, as shown in table 24. figure 37. parallel programming table 21. supply voltage during programming part serial programming parallel programming attiny28 not applicable 4.5 - 5.5v vcc +5v reset gnd xtal1 pd1 pd2 pd3 pd4 pd5 pd6 +12v rdy/bsy oe bs xa0 xa1 wr pb7 - pb0 data attiny28
48 attiny28l/v 1062f?avr?07/06 . enter programming mode the following algorithm puts the device in parallel programming mode: 1. apply 4.5 - 5.5v between vcc and gnd. 2. set reset and bs pins to ?0? and wait at least 100 ns. 3. apply 11.5 - 12.5v to reset . any activity on bs within 100 ns after +12v has been applied to reset will cause the device to fail entering programming mode. table 22. pin name mapping signal name in programming mode pin name i/o function rdy/bsy pd1 o ?0?: device is busy programming, ?1?: device is ready for new command oe pd2 i output enable (active low) wr pd3 i write pulse (active low) bs pd4 i byte select (?0? select s low byte, ?1? selects high byte) xa0 pd5 i xtal1 action bit 0 xa1 pd6 i xtal1 action bit 1 data pb7 - pb0 i/o bi-directional data bus (output when oe is low) table 23. xa1 and xa0 coding xa1 xa0 action when xtal1 is pulsed 00 load flash/signature byte address (high or low address byte for flash determined by bs) 0 1 load data (high or low data byte for flash determined by bs) 1 0 load command 1 1 no action, idle table 24. command byte coding command byte command executed 1000 0000 chip erase 0100 0000 write fuse bits 0010 0000 write lock bits 0001 0000 write flash 0000 1000 read signature bytes and calibration byte 0000 0100 read fuse and lock bits 0000 0010 read flash
49 attiny28l/v 1062f?avr?07/06 chip erase the chip erase command will er ase the flash memory and th e lock bits. the lock bits are not reset until the flash has been completely erased. the fuse bits are not changed. chip erase must be performed before the flash is reprogrammed. load command ?chip erase? 1. set xa1, xa0 to ?10?. this enables command loading. 2. set bs to ?0?. 3. set data to ?1000 0000?. this is the command for chip erase. 4. give xtal1 a positive pulse. this loads the command. 5. give wr a negative pulse. this starts the chip erase. rdy/bsy goes low. 6. wait until rdy/bsy goes high before loading a new command. programming the flash a: load command ?write flash? 1. set xa1, xa0 to ?10?. this enables command loading. 2. set bs to ?0?. 3. set data to ?0001 0000?. this is the command for write flash. 4. give xtal1 a positive pulse. this loads the command. b: load address high byte 1. set xa1, xa0 to ?00?. this enables address loading. 2. set bs to ?1?. this selects high byte. 3. set data = address high byte ($00 - $03). 4. give xtal1 a positive pulse. this loads the address high byte. c: load address low byte 1. set xa1, xa0 to ?00?. this enables address loading. 2. set bs to ?0?. this selects low byte. 3. set data = address low byte ($00 - $ff). 4. give xtal1 a positive pulse. this loads the address low byte. d: load data low byte 1. set xa1, xa0 to ?01?. this enables data loading. 2. set data = data low byte ($00 - $ff). 3. give xtal1 a positive pulse. this loads the data low byte. e: write data low byte 1. set bs to ?0?. this selects low data. 2. give wr a negative pulse. this starts programming of the data byte. rdy/bsy goes low. 3. wait until rdy/bsy goes high to program the next byte. (see figure 38 for signal waveforms.) f: load data high byte 1. set xa1, xa0 to ?01?. this enables data loading. 2. set data = data high byte ($00 - $ff). 3. give xtal1 a positive pulse. this loads the data high byte. g: write data high byte
50 attiny28l/v 1062f?avr?07/06 1. set bs to ?1?. this selects high data. 2. give wr a negative pulse. this starts programming of the data byte. rdy/bsy goes low. 3. wait until rdy/bsy goes high to program the next byte. (see figure 39 for signal waveforms.) the loaded command and address are retained in the device during programming. for efficient programming, the following should be considered: ? the command needs to be loaded only once when writing or reading multiple memory locations. ? address high byte only needs to be loaded before programming a new 256-word page in the flash. ? skip writing the data value $ff, that is, the contents of the entire flash after a chip erase. these considerations also apply to flash and signature bytes reading. reading the flash the algorithm for reading the flash memory is as follows (refer to ?programming the flash? for details on command and address loading): a: load command ?0000 0010?. b: load address high byte ($00 - $03). c: load address low byte ($00 - $ff). 1. set oe to ?0?, and bs to ?0?. the flash word low byte can now be read at data. 2. set bs to ?1?. the flash word high byte can now be read from data. 3. set oe to ?1?. programming the fuse bits the algorithm for programming the fuse bits is as follows (refer to ?programming the flash? for details on command and data loading): a: load command ?0100 0000?. d: load data low byte. bit n = ?0? programs and bit n = ?1? erases the fuse bit. bit 4 = intcap fuse bit 3 = cksel3 fuse bit 2 = cksel2 fuse bit 1 = cksel1 fuse bit 0 = cksel0 fuse bits 7 - 5 = ?1?. these bits are reserved and should be left unprogrammed (?1?). e: write data low byte. programming the lock bits the algorithm for programming the lock bits is as follows (refer to ?programming the flash? for details on command and data loading): a: load command ?0010 0000?. d: load data low byte. bit n = ?0? programs the lock bit. bit 2 = lock bit2 bit 1 = lock bit1 bits 7 - 3,0 = ?1?. these bits are reserved and should be left unprogrammed (?1?). e: write data low byte. the lock bits can only be cleared by executing chip erase.
51 attiny28l/v 1062f?avr?07/06 reading the fuse and lock bits the algorithm for reading the fuse and lock bits is as follows (refer to ?programming the flash? for details on command loading): a: load command ?0000 0100?. 1. set oe to ?0?, and bs to ?0?. the status of the fuse bits can now be read at data (?0? means programmed). bit 4 = intcap fuse bit 3 = cksel3 fuse bit 2 = cksel2 fuse bit 1 = cksel1 fuse bit 0 = cksel0 fuse 2. set bs to ?1?. the status of the lock bits can now be read at data (?0? means programmed). bit 2: lock bit2 bit 1: lock bit1 3. set oe to ?1?. reading the signature bytes and calibration byte the algorithm for reading the signature bytes and the calibration byte is as follows (refer to ?programming the flash? for details on command and address loading): a: load command ?0000 1000?. c: load address low byte ($00 - $02). 1. set oe to ?0?, and bs to ?0?. the selected signature byte can now be read at data. c: load address low byte ($00). 1. set oe to ?0?, and bs to ?1?. the calibration byte can now be read at data. 2. set oe to ?1?. figure 38. programming the flash waveforms $10 addr. high addr. low data low data xa1 xa0 bs xtal1 wr rdy/bsy reset oe 12v
52 attiny28l/v 1062f?avr?07/06 figure 39. programming the flash waveforms (continued) data high data xa1 xa0 bs xtal1 wr rdy/bsy reset +12v oe
53 attiny28l/v 1062f?avr?07/06 parallel programming characteristics figure 40. parallel programming timing t a = 25 c 10%, v cc = 5v 10% symbol parameter min typ max unit v pp programming enable voltage 11.5 12.5 v i pp programming enable current 250.0 a t dvxh data & control valid before xtal1 high 67.0 ns t xhxl xtal1 pulse width high 67.0 ns t xldx data & control hold after xtal1 low 67.0 ns t xlwl xtal1 low to wr low 67.0 ns t bvwl bs valid to wr low 67.0 ns t rhbx bs hold after rdy/bsy high 67.0 ns t wlwh wr pulse width low 67.0 ns t wlrl wr low to rdy/bsy low 0.0 2.5 s t wlrh wr low to rdy/bsy high 0.5 0.7 0.9 ms t xlol xtal1 low to oe low 67.0 ns t oldv oe low to data valid 20.0 ns t ohdz oe high to data tri-stated 20.0 ns data & contol (data, xa0/1, bs) data write read xtal1 t xhxl t wlwh t dvxh t xlol t oldv t wlrl t wlrh wr rdy/bsy oe t xldx t xlwl t rhbx t ohdz t bvwl
54 attiny28l/v 1062f?avr?07/06 electrical characteristics absolute maximum ratings operating temperature............................. -40 c to +85/105 c *notice: stresses beyond those ratings listed under ?absolute maximum ratings? may cause perma- nent damage to the device. this is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. exposure to absolute maximum rat- ing conditions for extended periods may affect device reliability. storage temperature ..................................... -65 c to +150 c voltage on any pin except reset with respect to ground .............................-1.0v to v cc + 0.5v maximum operating voltage ............................................ 6.0v voltage on reset with respect to ground ....-1.0v to +13.0v dc current per i/o pin, except pa2 ........................... 40.0 ma dc current pa2 .......................................................... 60.0 ma dc current vcc and gnd pin................................. 300.0 ma dc characteristics t a = -40 c to 85 c, v cc = 1.8v to 5.5v (unless otherwise noted) symbol parameter condition min typ max units v il input low voltage (except xtal) -0.5 0.3 vcc (1) v v il1 input low voltage xtal -0.5 0.1 vcc (1) v v ih input high voltage (except xtal, reset ) 0.6 v cc (2) v cc + 0.5 v v ih1 input high voltage xtal 0.7 v cc (2) v cc + 0.5 v v ih2 input high volt age reset 0.85 v cc (2) v cc + 0.5 v v ol output low voltage (3) ports a, d i ol = 20 ma, v cc = 5v i ol = 10 ma, v cc = 3v 0.6 0.5 v v v ol output low voltage (3) port a2 i ol = 25 ma, v cc = 2.0v 1.0 v v v oh output high voltage (4) ports a, d i oh = -3 ma, v cc = 5v i oh = -1.5 ma, v cc = 3v 4.3 2.3 v v i il input leakage current i/o pin v cc = 5.5v, pin low (absolute value) 8.0 a i il input leakage current i/o pin v cc = 5.5v, pin high (absolute value) 8.0 a r i/o i/o pin pull-up 35.0 122.0 k i cc power supply current active mode, v cc = 3v, 4mhz 3.0 ma idle mode v cc = 3v, 4mhz 1.0 1.2 ma power-down (5)(6) , v cc = 3v wdt enabled 9.0 15.0 a power-down (5)(6) , v cc = 3v wdt disabled <1.0 2.0 a
55 attiny28l/v 1062f?avr?07/06 notes: 1. ?max? means the highest value where the pin is guaranteed to be read as low. 2. ?min? means the lowest value where t he pin is guaranteed to be read as high. 3. although each i/o port can sink more than the test conditions (20 ma at v cc = 5v, 10 ma at v cc = 3v) under steady-state conditions (non-transient), th e following must be observed: 1] the sum of all i ol , for all ports, should not exceed 300 ma. 2] the sum of all i ol , for port d0 - d7 and xtal2 should not exceed 100 ma. if i ol exceeds the test condition, v ol may exceed the related specification. pins are not guaranteed to sink current greater than the listed test conditions. 4. although each i/o port can source more than the test conditions (3 ma at v cc = 5v, 1.5 ma at v cc = 3v) under steady-state conditions (non-transient), th e following must be observed: 1] the sum of all i oh , for all ports, should not exceed 300 ma. 2] the sum of all i oh , for port d0 - d7 and xtal2 should not exceed 100 ma. if i oh exceeds the test condition, v oh may exceed the related specification. pins are not guaranteed to source curren t greater than the listed test conditions. 5. minimum v cc for power-down is 1.5v. 6. when entering power-down, porta2 bit in porta register should be set. v acio analog comparator input offset voltage v cc = 5v v in = v cc /2 40.0 mv i aclk analog comparator input leakage current v cc = 5v v in = v cc /2 -50.0 50.0 na t acpd analog comparator propagation delay v cc = 2.7v v cc = 4.0v 750.0 500.0 ns dc characterist ics (continued) t a = -40 c to 85 c, v cc = 1.8v to 5.5v (unless otherwise noted) symbol parameter condition min typ max units
56 attiny28l/v 1062f?avr?07/06 external clock drive waveforms figure 41. external clock : note: r should be in the range 3 - 100 k , and c should be at least 20 pf. vil1 vih1 external clock drive symbol parameter v cc = 1.8v to 2.7v v cc = 2.7v to 4.0v v cc = 4.0v to 5.5v units minmaxminmaxminmax 1/t clcl oscillator frequency 0.0 1.2 0.0 4.0 0.0 4.0 mhz t clcl clock period 833.0 250.0 250.0 ns t chcx high time 333.0 100.0 100.0 ns t clcx low time 333.0 100.0 100.0 ns t clch rise time 1.6 1.6 0.5 s t chcl fall time 1.6 1.6 0.5 s table 25. external rc oscillator, typical frequencies r [k ]c [pf] f 100.0 70.0 100.0 khz 31.5 20.0 1.0 mhz 6.5 20.0 4.0 mhz
57 attiny28l/v 1062f?avr?07/06 typical characteristics the following charts show typical behavior. these figures are not tested during manu- facturing. all current consumption measurements are performed with all i/o pins configured as inputs and with internal pull-ups enabled. a sine wave generator with rail- to-rail output is used as clock source. the power consumption in power-down mode is independent of clock selection. the current consumption is a function of several factors, such as: operating voltage, operating frequency, loading of i/o pins, switching rate of i/o pins, code executed and ambient temperature. the dominating factors are operating voltage and frequency. the current drawn from capacitive loaded pins may be estimated (for one pin) as c l ? v cc ? f, where c l = load capacitance, v cc = operating voltage and f = average switching fre- quency of i/o pin. the parts are characterized at frequencies and voltages higher than test limits. parts are not guaranteed to function properly at frequencies and voltages higher than the ordering code indicates. the difference between current consumption in power-down mode with watchdog timer enabled and power-down mode with watchdog timer disabled represents the dif- ferential current drawn by the watchdog timer. figure 42. active supply current vs. frequency 0 2 4 6 8 10 12 14 16 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 t a = 25?c i cc (ma) active supply current vs. frequency frequency (mhz) v cc = 2.7v v cc = 2.4v v cc = 2.1v v cc = 1.8v v cc = 3.0v v cc = 3.3v v cc = 3.6v v cc = 4.0v v cc = 4.5v v cc = 5.0v v cc = 5.5v v cc = 6.0v
58 attiny28l/v 1062f?avr?07/06 figure 43. active supply current vs. v cc figure 44. active supply current vs. v cc , device clocked by internal oscillator active supply current vs. v cc frequency = 4 mhz i cc (ma) v cc (v) 0 1 2 3 4 5 6 7 8 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 25?c t a = 85?c active supply current vs. v cc device clocked by 1.2mhz internal rc oscillator i cc (ma) v cc (v) t = 85 ? c a t = 25 ? c a 0 1 2 3 4 5 6 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
59 attiny28l/v 1062f?avr?07/06 figure 45. active supply current vs. v cc , device clocked by external 32 khz crystal figure 46. idle supply current vs. frequency active supply current vs. v cc device clocked by 32 khz crystal i cc (ma) v cc (v) 0 0.5 1 1.5 2 2.5 3 3.5 4 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 85?c t a = 25?c t a = 25?c i cc (ma) idle supply current vs. frequency frequency (mhz) 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 v cc = 1.8v v cc = 2.1v v cc = 2.4v v cc = 2.7v v cc = 3.0v v cc = 3.3v v cc = 3.6v v cc = 4.0v v cc = 4.5v v cc = 5.0v v cc = 5.5v v cc = 6.0v
60 attiny28l/v 1062f?avr?07/06 figure 47. idle supply current vs. v cc figure 48. idle supply current vs. v cc , device clocked by internal oscillator idle supply current vs. v cc frequency = 4 mhz i cc (ma) v cc (v) 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 85?c t a = 25?c idle supply current vs. v cc device clocked by 1.2mhz internal rc oscillator i cc (ma) v cc (v) t = 85 ? c a t = 25 ? c a 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
61 attiny28l/v 1062f?avr?07/06 figure 49. idle supply current vs. v cc , device clocked by ex ternal 32 khz crystal figure 50. power-down supply current vs. v cc idle supply current vs. v cc device clocked by 32 khz crystal i cc (a) v cc (v) 0 5 10 15 20 25 30 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 25?c t a = 85?c power-down supply current vs. v cc watchdog timer disabled i cc (a) v cc (v) 0 0.5 1 1.5 2 2.5 3 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 70?c t a = 85?c t a = 45?c t a = 25?c
62 attiny28l/v 1062f?avr?07/06 figure 51. power-down supply current vs. v cc analog comparator offset voltage is measured as absolute offset. figure 52. analog comparator offset voltage vs. common mode voltage (v cc = 5v) power-down supply current vs. v cc watchdog timer enabled i cc (a) v cc (v) 0 10 20 30 40 50 60 70 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 t a = 85?c t a = 25?c 0 2 4 6 8 10 12 14 16 18 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 common mode voltage (v) offset voltage (mv) t a = 85?c t a = 25?c
63 attiny28l/v 1062f?avr?07/06 figure 53. analog comparator offset voltage vs. common mode voltage (v cc = 2.7v) figure 54. analog comparator input leakage current (v cc = 6v; t a = 25 c) 0 2 4 6 8 10 0 0.5 1 1.5 2 2.5 3 common mode voltage (v) offset voltage (mv) t a = 25?c t a = 85?c 60 50 40 30 20 10 0 -10 0 0.5 1.5 1 2 2.5 3.5 3 4 4.5 5 6 6.5 7 5.5 i aclk (na) v in (v)
64 attiny28l/v 1062f?avr?07/06 figure 55. calibrated internal rc os cillator frequency vs. v cc figure 56. watchdog oscillator frequency vs. v cc calibrated rc oscillator frequency vs. f rc (mhz) v cc (v) t = 45 ? c a t = 70 ? c a operating voltage 1.1 1.12 1.14 1.16 1.18 1.2 1.22 1.24 1.26 1.28 2 2.5 3 3.5 4 4.5 5 5.5 6 t = 25 ? c a t = 85 ? c a 0 200 400 600 800 1000 1200 1400 1600 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 v cc (v) f rc (khz) t a = 85?c t a = 25?c
65 attiny28l/v 1062f?avr?07/06 sink and source capabilities of i/o ports are measured on one pin at a time. figure 57. pull-up resistor current vs. input voltage (v cc = 5v) figure 58. pull-up resistor current vs. input voltage (v cc = 2.7v) 0 20 40 60 80 100 120 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 i op (?) v op (v) t a = 85?c t a = 25?c 0 5 10 15 20 25 30 0 0.5 1 1.5 2 2.5 3 i op (?) v (v) op t a = 25?c t a = 85?c
66 attiny28l/v 1062f?avr?07/06 figure 59. i/o pin sink current vs. output voltage. all pins except pa2 (v cc = 5v) figure 60. i/o pin source current vs. output voltage (v cc = 5v) 0 10 20 30 40 50 60 70 0 0.5 1 1.5 2 2.5 3 i ol (ma) v ol (v) t a = 25?c t a = 85?c 0 2 4 6 8 10 12 14 16 18 20 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 i oh (ma) v oh (v) t a = 25?c t a = 85?c
67 attiny28l/v 1062f?avr?07/06 figure 61. i/o pin sink current vs. output voltage, all pins except pa2 (v cc = 2.7v) figure 62. i/o pin source current vs. output voltage (v cc = 2.7v) 0 5 10 15 20 25 0 0.5 1 1.5 2 i ol (ma) v ol (v) t a = 25?c t a = 85?c 0 1 2 3 4 5 6 0 0.5 1 1.5 2 2.5 3 i oh (ma) v oh (v) t a = 25?c t a = 85?c
68 attiny28l/v 1062f?avr?07/06 figure 63. pa2 i/o pin sink current vs. output voltage (high current pin pa2; t a = 25 c) figure 64. i/o pin input threshold voltage vs. v cc (t a = 25 c) 0 10 20 30 40 50 60 70 80 90 0 0.5 1 1.5 2 2.5 3 3.5 4 v ol (v) i ol (ma) v cc = 1.8v v cc = 3.6v v cc = 2.4v 0 0.5 1 1.5 2 2.5 2.7 4.0 5.0 threshold voltage (v) v cc
69 attiny28l/v 1062f?avr?07/06 figure 65. i/o pin input hysteresis vs. v cc (t a = 25 c) 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 2.7 4.0 5.0 input hysteresis (v) v cc
70 attiny28l/v 1062f?avr?07/06 notes: 1. for compatibility with future devices, reserved bits shoul d be written to zero if accessed. reserved i/o memory address es should never be written. 2. some of the status flags are cleared by writing a logical ?1 ? to them. note that the cbi and sbi instructions will operate on all bits in the i/o register, writing a one back into any flag read as set, thus clearing the flag. the cbi and sbi instructions wo rk with registers $00 to $1f only. register summary address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 page $3f sreg i t h s v n z c page 6 $3e reserved ... reserved $20 reserved $1f reserved $1e reserved $1d reserved $1c reserved $1b porta - - - - porta3 porta2 porta1 porta0 page 32 $1a pacr - - - - dda3 pa2hc dda1 dda0 page 32 $19 pina - - - -pina3 - pina1 pina0 page 32 $18 reserved $17 reserved $16 pinb pinb7 pinb6 pinb5 pinb4 pinb3 pinb2 pinb1 pinb0 page 32 $15 reserved $14 reserved $13 reserved $12 portd portd7 portd6 portd5 portd4 portd3 portd2 portd1 portd0 page 33 $11 ddrd ddd7 ddd6 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 page 33 $10 pind pind7 pind6 pind5 pind 4 pind3 pind2 pind1 pind0 page 33 $0f reserved $0e reserved $0d reserved $0c reserved $0b reserved $0a reserved $09 reserved $08 acsr acd -acoaciacie - acis1 acis0 page 44 $07 mcucs plupb - se sm wdrf - extrf porf page 19 $06 icr int1 int0 llie toie0 isc11 isc10 isc01 isc00 page 22 $05 ifr intf1 intf0 -tov0 - - - - page 23 $04 tccr0 fov0 - - oom01 oom00 cs02 cs01 cs00 page 35 $03 tcnt0 timer/counter0 (8-bit) page 36 $02 modcr ontim4 ontim3 ontim2 ontim1 ontim0 mconf2 mconf1 mconf0 page 43 $01 wdtcr - - - wdtoe wde wdp2 wdp1 wdp0 page 37 $00 osccal oscillator calibration register page 9
71 attiny28l/v 1062f?avr?07/06 instruction set summary mnemonic operands description operation flags # clocks arithmetic and logic instructions add rd, rr add two registers rd rd + rr z,c,n,v,h 1 adc rd, rr add with carry two registers rd rd + rr + c z,c,n,v,h 1 sub rd, rr subtract two registers rd rd - rr z,c,n,v,h 1 subi rd, k subtract constant from register rd rd - k z,c,n,v,h 1 sbc rd, rr subtract with carry two registers rd rd - rr - c z,c,n,v,h 1 sbci rd, k subtract with carry constant from reg. rd rd - k - c z,c,n,v,h 1 and rd, rr logical and registers rd rd ? rr z,n,v 1 andi rd, k logical and register and constant rd rd ? k z,n,v 1 or rd, rr logical or registers rd rd v rr z,n,v 1 ori rd, k logical or register and constant rd rd v k z,n,v 1 eor rd, rr exclusive or registers rd rd rr z,n,v 1 com rd one?s complement rd $ff - rd z,c,n,v 1 neg rd two?s complement rd $00 - rd z,c,n,v,h 1 sbr rd, k set bit(s) in register rd rd v k z,n,v 1 cbr rd, k clear bit(s) in register rd rd ? (ffh - k) z,n,v 1 inc rd increment rd rd + 1 z,n,v 1 dec rd decrement rd rd - 1 z,n,v 1 tst rd test for zero or minus rd rd ? rd z,n,v 1 clr rd clear register rd rd rd z,n,v 1 ser rd set register rd $ff none 1 branch instructions rjmp k relative jump pc pc + k + 1 none 2 rcall k relative subroutine call pc pc + k + 1 none 3 ret subroutine return pc stack none 4 reti interrupt return pc stack i 4 cpse rd, rr compare, skip if equal if (rd = rr) pc pc + 2 or 3 none 1/2 cp rd, rr compare rd - rr z,n,v,c,h 1 cpc rd, rr compare with carry rd - rr - c z,n,v,c,h 1 cpi rd, k compare register with immediate rd - k z n,v,c,h 1 sbrc rr, b skip if bit in register cleared if (rr(b) = 0) pc pc + 2 or 3 none 1/2 sbrs rr, b skip if bit in regist er is set if (rr(b) = 1) pc pc + 2 or 3 none 1/2 sbic p, b skip if bit in i/o register cleared if (p(b) = 0) pc pc + 2 or 3 none 1/2 sbis p, b skip if bit in i/o register is set if (p(b) = 1) pc pc + 2 or 3 none 1/2 brbs s, k branch if status flag set if (sreg(s) = 1) then pc pc + k + 1 none 1/2 brbc s, k branch if status flag cleared if (sreg(s) = 0) then pc pc + k + 1 none 1/2 breq k branch if equal if (z = 1) then pc pc + k + 1 none 1/2 brne k branch if not equal if (z = 0) then pc pc + k + 1 none 1/2 brcs k branch if carry set if (c = 1) then pc pc + k + 1 none 1/2 brcc k branch if carry cleared if (c = 0) then pc pc + k + 1 none 1/2 brsh k branch if same or higher if (c = 0) then pc pc + k + 1 none 1/2 brlo k branch if lower if (c = 1) then pc pc + k + 1 none 1/2 brmi k branch if minus if (n = 1) then pc pc + k + 1 none 1/2 brpl k branch if plus if (n = 0) then pc pc + k + 1 none 1/2 brge k branch if greater or equal, signed if (n v = 0) then pc pc + k + 1 none 1/2 brlt k branch if less than zero, signed if (n v = 1) then pc pc + k + 1 none 1/2 brhs k branch if half-carry flag set if (h = 1) then pc pc + k + 1 none 1/2 brhc k branch if half-carry flag cleared if (h = 0) then pc pc + k + 1 none 1/2 brts k branch if t-flag set if (t = 1) then pc pc + k + 1 none 1/2 brtc k branch if t-flag cleared if (t = 0) then pc pc + k + 1 none 1/2 brvs k branch if overflow flag is set if (v = 1) then pc pc + k + 1 none 1/2 brvc k branch if overflow flag is cleared if (v = 0) then pc pc + k + 1 none 1/2 brie k branch if interrupt enabled if (i = 1) then pc pc + k + 1 none 1/2 brid k branch if interrupt disabled if (i = 0) then pc pc + k + 1 none 1/2
72 attiny28l/v 1062f?avr?07/06 data transfer instructions ld rd, z load register indirect rd (z) none 2 st z, rr store register indirect (z) rr none 2 mov rd, rr move between registers rd rr none 1 ldi rd, k load immediate rd knone1 in rd, p in port rd pnone1 out p, rr out port p rr none 1 lpm load program memory r0 (z) none 3 bit and bit-test instructions sbi p, b set bit in i/o register i/o(p,b) 1none2 cbi p, b clear bit in i/o register i/o(p,b) 0none2 lsl rd logical shift left rd(n+1) rd(n), rd(0) 0 z,c,n,v 1 lsr rd logical shift right rd(n) rd(n+1), rd(7) 0 z,c,n,v 1 rol rd rotate left through carry rd(0) c, rd(n+1) rd(n), c rd(7) z,c,n,v 1 ror rd rotate right through carry rd(7) c, rd(n) rd(n+1), c rd(0) z,c,n,v 1 asr rd arithmetic shift right rd(n) rd(n+1), n = 0..6 z,c,n,v 1 swap rd swap nibbles rd(3..0) rd(7..4), rd(7..4) rd(3..0) none 1 bset s flag set sreg(s) 1 sreg(s) 1 bclr s flag clear sreg(s) 0 sreg(s) 1 bst rr, b bit store from register to t t rr(b) t 1 bld rd, b bit load from t to register rd(b) tnone1 sec set carry c 1c1 clc clear carry c 0c1 sen set negative flag n 1n1 cln clear negative flag n 0n1 sez set zero flag z 1z1 clz clear zero flag z 0z1 sei global interrupt enable i 1i1 cli global interrupt disable i 0i1 ses set signed test flag s 1s1 cls clear signed test flag s 0s1 sev set two?s complement overflow v 1v1 clv clear two?s complement overflow v 0v1 set set t in sreg t 1t1 clt clear t in sreg t 0t1 seh set half-carry flag in sreg h 1h1 clh clear half-carry flag in sreg h 0h1 nop no operation none 1 sleep sleep (see specific descr. for sleep function) none 1 wdr watchdog reset (see specific descr. for wdr/timer) none 1 instruction set summary (continued) mnemonic operands description operation flags # clocks
73 attiny28l/v 1062f?avr?07/06 notes: 1. this device can also be supplied in wafer form. please contact your local atmel sales office for detailed ordering info rmation and minimum quantities. 2. pb-free packaging alternative, complies to the european dire ctive for restriction of hazardous substances (rohs direc- tive).also halide free and fully green. ordering information speed (mhz) power supply (volts) ordering code package (1) operation range 4 2.7 - 5.5 attiny28l-4ac attiny28l-4pc attiny28l-4mc 32a 28p3 32m1-a commercial (0 c to 70 c) attiny28l-4ai attiny28l-4au (2) attiny28l-4pi ATTINY28L-4PU (2) attiny28l-4mi attiny28l-4mu (2) 32a 32a 28p3 28p3 32m1-a 32m1-a industrial (-40 c to 85 c) 1.2 1.8 - 5.5 attiny28v-1ac attiny28v-1pc attiny28v-1mc 32a 28p3 32m1-a commercial (0 c to 70 c) attiny28v-1ai attiny28v-1au (2) attiny28v-1pi attiny28v-1pu (2) attiny28v-1mi attiny28v-1mu (2) 32a 32a 28p3 28p3 32m1-a 32m1-a industrial (-40 c to 85 c) package type 32a 32-lead, thin (1.0 mm) plastic quad flat package (tqfp) 28p3 28-lead, 0.300" wide, plastic dual inline package (pdip) 32m1-a 32-pad, 5x5x1.0 body, lead pitch 0.50mm, quad flat no-lead/micr o lead frame package (qfn/mlf)
74 attiny28l/v 1062f?avr?07/06 packaging information 32a 2325 orchard parkway san jose, ca 95131 title drawing no. r rev. 32a, 32-lead, 7 x 7 mm body size, 1.0 mm body thickness, 0.8 mm lead pitch, thin profile plastic quad flat package (tqfp) b 32a 10/5/2001 pin 1 identifier 0?~7? pin 1 l c a1 a2 a d1 d e e1 e b notes: 1. this package conforms to jedec reference ms-026, variation aba. 2. dimensions d1 and e1 do not include mold protrusion. allowable protrusion is 0.25 mm per side. dimensions d1 and e1 are maximum plastic body size dimensions including mold mismatch. 3. lead coplanarity is 0.10 mm maximum. a ? ? 1.20 a1 0.05 ? 0.15 a2 0.95 1.00 1.05 d 8.75 9.00 9.25 d1 6.90 7.00 7.10 note 2 e 8.75 9.00 9.25 e1 6.90 7.00 7.10 note 2 b 0.30 ? 0.45 c 0.09 ? 0.20 l 0.45 ? 0.75 e 0.80 typ common dimensions (unit of measure = mm) symbol min nom max note
75 attiny28l/v 1062f?avr?07/06 28p3 2325 orchard parkway san jose, ca 95131 title drawing no. r rev. 28p3 , 28-lead (0.300"/7.62 mm wide) plastic dual inline package (pdip) b 28p3 09/28/01 pin 1 e1 a1 b ref e b1 c l seating plane a 0o ~ 15o d e eb b2 (4 places) common dimensions (unit of measure = mm) symbol min nom max note a ? ? 4.5724 a1 0.508 ? ? d 34.544 ? 34.798 note 1 e 7.620 ? 8.255 e1 7.112 ? 7.493 note 1 b 0.381 ? 0.533 b1 1.143 ? 1.397 b2 0.762 ? 1.143 l 3.175 ? 3.429 c 0.203 ? 0.356 eb ? ? 10.160 e 2.540 typ note: 1. dimensions d and e1 do not include mold flash or protrusion. mold flash or protrusion shall not exceed 0.25 mm (0.010").
76 attiny28l/v 1062f?avr?07/06 32m1-a 2 3 25 orch a rd p a rkw a y sa n jo s e, ca 951 3 1 title drawing no. r rev. 3 2m1-a , 3 2-p a d, 5 x 5 x 1.0 mm body, le a d pitch 0.50 mm, e 3 2m1-a 5/25/06 3 .10 mm expo s ed p a d, micro le a d fr a me p a ck a ge (mlf) common dimen s ion s (unit of me asu re = mm) s ymbol min nom max note d1 d e1 e e b a 3 a2 a1 a d2 e2 0.0 8 c l 1 2 3 p p 0 1 2 3 a 0. 8 0 0.90 1.00 a1 ? 0.02 0.05 a2 ? 0.65 1.00 a 3 0.20 ref b 0.1 8 0.2 3 0. 3 0 d d1 d2 2.95 3 .10 3 .25 4.90 5.00 5.10 4.70 4.75 4. 8 0 4.70 4.75 4. 8 0 4.90 5.00 5.10 e e1 e2 2.95 3 .10 3 .25 e 0.50 b s c l 0. 3 0 0.40 0.50 p ? ? 0.60 ? ? 12 o note: jedec s t a nd a rd mo-220, fig. 2 (anvil s ing u l a tion), vhhd-2. top view s ide view bottom view 0 pin 1 id pin #1 notch (0.20 r) k 0.20 k k
77 attiny28l/v 1062f?avr?07/06 errata all revisions no known errata.
78 attiny28l/v 1062f?avr?07/06 datasheet revision history please note that the referring page numbers in this section are referred to this docu- ment. the referring revision in this section are referring to the document revision. rev ? 01/06g 1. updated chapter layout. 2. updated ?ordering information? on page 73. rev ? 01/06g 1. updated description for ?port a? on page 25. 2. added note 6 in ?dc characteristics? on page 54. 3. updated ?ordering information? on page 73. 4. added ?errata? on page 77. rev ? 03/05f 1. updated ?electrical characteristics? on page 54. 2. mlf-package alternative changed to ? quad flat no-lead/micro lead frame package qfn/mlf?. 3. updated ?ordering information? on page 73.
i attiny28l/v 1062f?avr?07/06 table of contents features............... ................. .............. .............. .............. .............. ......... 1 pin configurations............... .............. .............. .............. .............. ......... 1 description .......... ................. .............. .............. .............. .............. ......... 2 block diagram ...................................................................................................... 2 pin descriptions.................................................................................................... 3 clock options ....................................................................................................... 4 architectural overview........ .............. .............. .............. .............. ......... 6 general-purpose register file.............................................................................. 7 alu ? arithmetic logic unit.................................................................................. 7 downloadable flash program memory ................................................................ 7 program and data addressing modes.................................................................. 7 subroutine and interrupt hardware stack .......................................................... 10 memory access and instruction execution timing ............................................. 10 i/o memory ......................................................................................................... 11 reset and interrupt handling.............................................................................. 12 sleep modes....................................................................................................... 21 timer/counter0 .......... ................. ................ ................. .............. ......... 24 timer/counter prescaler..................................................................................... 24 watchdog timer............ ................ ................. .............. .............. ......... 27 calibrated internal rc oscill ator ............ ................ ................. ......... 29 hardware modulator ..... ................ ................. .............. .............. ......... 30 analog comparator ............... ................ ................. ................ ............ 35 i/o ports............. ................ .............. ............... .............. .............. ......... 37 port a.................................................................................................................. 37 port b.................................................................................................................. 40 port d.................................................................................................................. 43 memory programming........... ................ ................. ................ ............ 45 program memory lock bits ................................................................................ 45 fuse bits............................................................................................................. 45 signature bytes .................................................................................................. 45 calibration byte .................................................................................................. 45 programming the flash ...................................................................................... 45 parallel programming ......................................................................................... 46 parallel programming characteristics...... ................. .............. ......... 52
ii attiny28l/v 1062f?avr?07/06 electrical characteristics...... ................ ................. ................ ............ 53 absolute maximum ratings ................................................................................ 53 dc characteristics.............................................................................................. 53 external clock drive waveforms ........................................................................ 55 external clock drive ........................................................................................... 55 typical characteristics ......... ................ ................. ................ ............ 56 register summary ..... ................. ................ ................. .............. ......... 69 instruction set summary ...... ................ ................. ................ ............ 70 ordering information............. ................ ................. ................ ............ 72 packaging information .......... ................ ................. ................ ............ 74 32a ..................................................................................................................... 74 28p3 ................................................................................................................... 75 32m1-a ............................................................................................................... 76 errata ............... ................ ................ ............... .............. .............. ......... 77 all revisions......................................................................................................... 77 datasheet revision history ... ............... ................. ................ ............ 78 rev ? 01/06g...................................................................................................... 78 rev ? 03/05f ...................................................................................................... 78 table of contents ................ .............. .............. .............. .............. .......... i
printed on recycled paper. 1062f?avr?07/06 ? atmel corporation 2006 . all rights reserved. atmel ? , logo and combinations thereof, everywhere you are ? , avr ? , avr studio ? , and oth- ers, are registered trademarks or trademarks of atmel corporati on or its subsidiaries. other terms and product names may be tra demarks of oth- ers. disclaimer: the information in this document is provided in connection with atmel products. no license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of atmel products. except as set forth in atmel?s terms and condi- tions of sale located on atmel? s web site, atmel assumes no liability whatsoever and disclaims any express, implied or statutor y warranty relating to its products including, but not limited to , the implied warranty of merchantability, fitness for a particu lar purpose, or non-infringement. in no event shall atmel be liable for any direct, indirect, conseque ntial, punitive, special or i nciden- tal damages (including, without limitation, damages for loss of profits, business interruption, or loss of information) arising out of the use or inability to use this document, even if at mel has been advised of the possibility of such damages. atmel makes no representations or warranties with respect to the accuracy or co mpleteness of the contents of this document and reserves the rig ht to make changes to specifications and product descriptions at any time without notice. atmel does not make any commitment to update the information contained her ein. unless specifically provided otherwise, atmel products are not suitable for, and shall not be used in, automotive applications. atmel?s products are not int ended, authorized, or warranted for use as components in applications in tended to support or sustain life. atmel corporation atmel operations 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 487-2600 regional headquarters europe atmel sarl route des arsenaux 41 case postale 80 ch-1705 fribourg switzerland tel: (41) 26-426-5555 fax: (41) 26-426-5500 asia room 1219 chinachem golden plaza 77 mody road tsimshatsui east kowloon hong kong tel: (852) 2721-9778 fax: (852) 2722-1369 japan 9f, tonetsu shinkawa bldg. 1-24-8 shinkawa chuo-ku, tokyo 104-0033 japan tel: (81) 3-3523-3551 fax: (81) 3-3523-7581 memory 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 436-4314 microcontrollers 2325 orchard parkway san jose, ca 95131, usa tel: 1(408) 441-0311 fax: 1(408) 436-4314 la chantrerie bp 70602 44306 nantes cedex 3, france tel: (33) 2-40-18-18-18 fax: (33) 2-40-18-19-60 asic/assp/smart cards zone industrielle 13106 rousset cedex, france tel: (33) 4-42-53-60-00 fax: (33) 4-42-53-60-01 1150 east cheyenne mtn. blvd. colorado springs, co 80906, usa tel: 1(719) 576-3300 fax: 1(719) 540-1759 scottish enterprise technology park maxwell building east kilbride g75 0qr, scotland tel: (44) 1355-803-000 fax: (44) 1355-242-743 rf/automotive theresienstrasse 2 postfach 3535 74025 heilbronn, germany tel: (49) 71-31-67-0 fax: (49) 71-31-67-2340 1150 east cheyenne mtn. blvd. colorado springs, co 80906, usa tel: 1(719) 576-3300 fax: 1(719) 540-1759 biometrics/imagin g/hi-rel mpu/ high speed converters/rf datacom avenue de rochepleine bp 123 38521 saint-egreve cedex, france tel: (33) 4-76-58-30-00 fax: (33) 4-76-58-34-80 literature requests www.atmel.com/literature


▲Up To Search▲   

 
Price & Availability of ATTINY28L-4PU

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X